alias this bug?

Timothee Cour thelastmammoth at gmail.com
Sat Aug 24 02:09:41 PDT 2013


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!
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130824/3a964e08/attachment.html>


More information about the Digitalmars-d-learn mailing list