/* * As discussed on #d @ freenode on 2011-09-06 * Should this work ? * */ import std.stdio; struct s { int a; int b; int c; void opAssign (s value) { // Should opAssign be call for each array member ? (&this)[0..1] = (&value)[0..1]; // causes infinite loop (as it should) // this = value; this.c = 4; } } void main () { writeln("start"); s s1; s1.a = 1; s1.b = 2; s1.c = 3; s s2; s2 = s1; writeln(s1.a, " ", s1.b, " ", s1.c); // 1 2 3 writeln(s2.a, " ", s2.b, " ", s2.c); // 1 2 4 writeln("end"); }
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18368 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB