www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10895] New: alias this bug?


           Summary: alias this bug?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thelastmammoth gmail.com

--- Comment #0 from thelastmammoth gmail.com 2013-08-25 23:34:43 PDT ---
(posted under 'alias this bug?' in D newsgroup but didn't get any answer)

is this a bug?
the call to join invalidates the "name" field of A:

import std.array;
import std.stdio;
class A{
  string name;
  this(string name){this.name=name;}
  alias name this;

void main(){
  auto a=[new A(`foo`)];
  auto temp=a.join(" ");
  assert(!a[0].length); //a[0] is now empty!

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 25 2013