[Issue 10895] New: alias this bug?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 25 23:34:45 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10895

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


--- Comment #0 from thelastmammoth at 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;
  ~this(){
    writeln("deleting");
  }
}

void main(){
  auto a=[new A(`foo`)];
  assert(a[0].length);
  writeln("1");
  auto temp=a.join(" ");
  writeln("2");
  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: -------


More information about the Digitalmars-d-bugs mailing list