[Issue 6052] [CTFE] Structs elements in an array are treated like reference type
http://d.puremagic.com/issues/show_bug.cgi?id=6052 Don changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #4 from Don 2011-06-01 22:49:08 PDT --- case c: https://github.com/D-Programming-Language/dmd/commit/0ae51ead31246c7db23438d1d13bbfd8a2145f2f case d: https://github.com/D-Programming-Language/dmd/commit/084258c32964dc61333e057065339895d9aca6f0 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6052] [CTFE] Structs elements in an array are treated like reference type
http://d.puremagic.com/issues/show_bug.cgi?id=6052 kenn...@gmail.com changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #3 from kenn...@gmail.com 2011-05-31 01:34:45 PDT --- The bug still exists if the the struct has a constructor and we're appending to a dynamic array - struct Bug6052c { int x; this(int a) { x = a; } } static assert({ Bug6052c[] pieces = []; for (int c = 0; c < 2; ++ c) pieces ~= Bug6052c(c); assert(pieces[1].x == 1); // ok assert(pieces[0].x == 0); // asserts return true; }()); - x.d(10): Error: assert(pieces[0u].x == 0) failed - or filling the uninitialized portion of a dynamic array - static assert({ int[1][] pieces = []; pieces.length = 2; for (int c = 0; c < 2; ++ c) pieces[c][0] = c; assert(pieces[1][0] == 1); // ok assert(pieces[0][0] == 0); // asserts return true; }()); - x.d(7): Error: assert(pieces[0u][0u] == 0) failed - -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6052] [CTFE] Structs elements in an array are treated like reference type
http://d.puremagic.com/issues/show_bug.cgi?id=6052 Don changed: What|Removed |Added Status|NEW |RESOLVED CC||clugd...@yahoo.com.au Resolution||FIXED --- Comment #2 from Don 2011-05-30 17:02:43 PDT --- A related test case which also fails, but involves static arrays rather than structs: bool bug6052b() { int[][1] arr; int[1] z = [7]; arr[0] = z; assert(arr[0][0] == 7); arr[0] = z; z[0] = 3; assert(arr[0][0] == 3); return true; } static assert(bug6052b()); https://github.com/D-Programming-Language/dmd/commit/bccb02ad1d8578767f99efeab4a230a229e24392 Case b: https://github.com/D-Programming-Language/dmd/commit/2ee56a0038ccac3b2225b7feda9d69798cc203e3 D1: https://github.com/D-Programming-Language/dmd/commit/bccb02ad1d8578767f99efeab4a230a229e24392 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6052] [CTFE] Structs elements in an array are treated like reference type
http://d.puremagic.com/issues/show_bug.cgi?id=6052 kenn...@gmail.com changed: What|Removed |Added Severity|normal |regression -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6052] [CTFE] Structs elements in an array are treated like reference type
http://d.puremagic.com/issues/show_bug.cgi?id=6052 --- Comment #1 from kenn...@gmail.com 2011-05-24 09:10:47 PDT --- Note: the last 2 asserts refer to the case when the line 'el.a = i + 2;' is commented out. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---