digitalmars.D.learn - alias this bug?
- Timothee Cour (21/21) Aug 24 2013 is this a bug?
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! }
Aug 24 2013