[Issue 7444] Require [] for array copies too
https://issues.dlang.org/show_bug.cgi?id=7444 Iain Buclaw changed: What|Removed |Added Priority|P2 |P4 --
[Issue 7444] Require [] for array copies too
https://issues.dlang.org/show_bug.cgi?id=7444 Peter Alexander changed: What|Removed |Added CC||peter.alexander...@gmail.co ||m --- Comment #23 from Peter Alexander --- I just lost a bunch of time because of this issue (T[n] = e). I understand this is a breaking change. Is there perhaps a deprecation path to solving this? --
[Issue 7444] Require [] for array copies too
https://issues.dlang.org/show_bug.cgi?id=7444 --- Comment #22 from Sobirari Muhomori dfj1es...@sneakemail.com --- That's the reason for an unambiguous syntax a[*]=b[*]; --
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Resolution|FIXED |WONTFIX --- Comment #19 from Walter Bright bugzi...@digitalmars.com 2013-10-20 09:38:57 PDT --- This pull: https://github.com/D-Programming-Language/dmd/pull/2673 undoes it with explanation. Reclassified as wontfix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #20 from bearophile_h...@eml.cc 2013-10-20 10:49:58 PDT --- (In reply to comment #19) This pull: https://github.com/D-Programming-Language/dmd/pull/2673 undoes it with explanation. Reclassified as wontfix. What? After all the energy time and work spent on fixing this problem!? If you take a look at the patch by Kenji you see: - else if (global.params.warnings !global.gag op == TOKassign + else if (0 global.params.warnings !global.gag op == TOKassign That means the code is commented out, but it's meant to be activated back in dmd 2.065 to try to fix this issue better. I will probably re-open this issue later. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 bearophile_h...@eml.cc changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|WONTFIX | --- Comment #21 from bearophile_h...@eml.cc 2013-10-20 12:29:43 PDT --- Reopened, this will wait for dmd 2.065, to see if Kenji or others are able to find a solution. If no solution will be found, we'll close this again. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #13 from bearophile_h...@eml.cc 2013-03-07 04:22:27 PST --- (In reply to comment #12) Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/57b770ed49379c5af726d23356e0f75818a3f859 Issue 7444 - Require [] for array copies too https://github.com/D-Programming-Language/dmd/commit/ba1009c5561b51b8f18d9c869fde9bd45cb7ebc7 Merge pull request #702 from 9rnsr/fix7444 Issue 7444 - Require [] for array copies too I have tried this change, and now the first test case of this ER: int[100] foo() { int[100] a; return a; } void main() { int[10_000] a, b; auto c = new int[10_000]; a = 1; a = b; a = c; auto d = foo(); } gives a ICE: temp.d(8): Warning: explicit element-wise assignment (a)[] = 1 is better than a = 1 temp.d(10): Warning: explicit element-wise assignment (a)[] = (c)[] is better than a = c Assertion failure: '0' on line 1193 in file 'glue.c' -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #14 from bearophile_h...@eml.cc 2013-03-07 04:58:19 PST --- (In reply to comment #13) gives a ICE: Smaller test case: void main() { int[1] a; a = 1; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #15 from Kenji Hara k.hara...@gmail.com 2013-03-07 05:14:27 PST --- (In reply to comment #14) (In reply to comment #13) gives a ICE: Smaller test case: void main() { int[1] a; a = 1; } What version and compiler switch do you use? I cannot reproduce the ICE. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #16 from bearophile_h...@eml.cc 2013-03-07 12:10:52 PST --- (In reply to comment #15) What version and compiler switch do you use? I cannot reproduce the ICE. I am using the GIT head compiler, I have downloaded and compiled dmd few hours ago, after this patch was merged. I am on Windows 32 bit, and I have compiled the code with: dmd -wi test.d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #17 from Kenji Hara k.hara...@gmail.com 2013-03-07 15:41:56 PST --- (In reply to comment #16) (In reply to comment #15) What version and compiler switch do you use? I cannot reproduce the ICE. I am using the GIT head compiler, I have downloaded and compiled dmd few hours ago, after this patch was merged. I am on Windows 32 bit, and I have compiled the code with: dmd -wi test.d Thanks. -w option does not reproduce it, but -wi does. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #18 from Kenji Hara k.hara...@gmail.com 2013-03-07 17:00:31 PST --- (In reply to comment #17) (In reply to comment #16) (In reply to comment #15) What version and compiler switch do you use? I cannot reproduce the ICE. I am using the GIT head compiler, I have downloaded and compiled dmd few hours ago, after this patch was merged. I am on Windows 32 bit, and I have compiled the code with: dmd -wi test.d Thanks. -w option does not reproduce it, but -wi does. OK, I opened a new report bug 9663 for the regression. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #12 from github-bugzi...@puremagic.com 2013-03-06 22:53:51 PST --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/57b770ed49379c5af726d23356e0f75818a3f859 Issue 7444 - Require [] for array copies too https://github.com/D-Programming-Language/dmd/commit/ba1009c5561b51b8f18d9c869fde9bd45cb7ebc7 Merge pull request #702 from 9rnsr/fix7444 Issue 7444 - Require [] for array copies too -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #11 from github-bugzi...@puremagic.com 2012-11-21 20:12:48 PST --- Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/e5895640c83d8b5b4c8b2404b4e639ba6fdf2243 Additional fix Issue 7444 in Posix platforms https://github.com/D-Programming-Language/druntime/commit/a54f41c98aa26eeb70274e8b78d8abfb575bcebc Merge pull request #352 from 9rnsr/fix7444 Additional fix Issue 7444 in Posix platforms -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #10 from github-bugzi...@puremagic.com 2012-11-20 09:55:06 PST --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/28dedee456e741f02f08a944f41daa9e46236224 Issue 7444 - Require [] for array copies too https://github.com/D-Programming-Language/phobos/commit/9a6dad8a2ac5841bdcfa2b86082450818f6eefab Merge pull request #960 from 9rnsr/fix7444 Supplemental changes for Issue 7444 - Require [] for array copies too -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #9 from github-bugzi...@puremagic.com 2012-10-14 19:19:00 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/a77c82772e7e7b2d1d863b1fb56b614b9d4bc6a1 fix Issue 7444 - Require [] for array copies too https://github.com/D-Programming-Language/druntime/commit/be3a7fa1bc726b453203c058ff2fa8c81dcfcab1 Merge pull request #314 from 9rnsr/fix7444 Supplemental changes for Issue 7444 - Require [] for array copies too -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #8 from bearophile_h...@eml.cc 2012-02-22 16:07:54 PST --- See why a consistent syntax matters: Issue 7564 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #7 from bearophile_h...@eml.cc 2012-02-18 05:02:07 PST --- (In reply to comment #6) I'm not sure this is worth the existing code breakage. I thin it's worth it, if you want with warning / deprecation / error stages. But if want, I'll ask for a little voting in the main D newsgroup. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #6 from Walter Bright bugzi...@digitalmars.com 2012-02-17 23:27:14 PST --- The enhancement is to disallow: sa = da; // use sa[] = da[] instead sa = e; // use sa[] = e instead I'm not sure this is worth the existing code breakage. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull --- Comment #5 from Kenji Hara k.hara...@gmail.com 2012-02-10 04:23:32 PST --- (In reply to comment #4) Maybe sa[] = da and da[] = da should be '// X' too. Hmm, OK. If it is an element-wise assignment, we should add explicit slicing both side of AssignExp. I've posted a pull to implement this enhancement: https://github.com/D-Programming-Language/dmd/pull/702 Updated test: https://github.com/D-Programming-Language/dmd/pull/702/files#L6R250 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #2 from Kenji Hara k.hara...@gmail.com 2012-02-09 05:33:52 PST --- (In reply to comment #1) While I agree that the syntax should be enforced more strictly in general, I still completely disagree with requiring [] on static array copies. Static arrays are value types of fixed size, and should be treated as such. Requiring [] is just wrong. void foo(int[4] x){} void foo(int[] y){} void main(){ int[4] x, y; struct S{int[4] x;} S a, b; x = y; a = b; // why should this work if the above does not? foo(x); // copies, you want this to be an error foo(x[]); // calls the other overload, does not copy } I completely agree with Timon. When x and y are declared with same type T, x = y is identity assignment, and it is valid syntax even if T is static array type. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #3 from Kenji Hara k.hara...@gmail.com 2012-02-09 06:31:34 PST --- I'd like to provide an exhaustive test that should compile after fixing the enhancement suggested by me and timon. // X: Changed accepts-invalid to rejects-invalid by this issue // a: slice assginment // b: element-wise assignment static assert(!__traits(compiles, { sa = e; })); // X static assert( __traits(compiles, { sa[] = e; })); // b static assert(!__traits(compiles, { da = e; })); static assert( __traits(compiles, { da[] = e; })); // b // lhs is static array static assert( __traits(compiles, { sa = sa; })); // b == identity assign static assert(!__traits(compiles, { sa = sa[]; })); // X static assert(!__traits(compiles, { sa[] = sa; })); // X static assert( __traits(compiles, { sa[] = sa[]; })); // b static assert(!__traits(compiles, { sa = da; })); // X static assert(!__traits(compiles, { sa = da[]; })); // X static assert( __traits(compiles, { sa[] = da; })); // b static assert( __traits(compiles, { sa[] = da[]; })); // b // lhs is dynamic array static assert(!__traits(compiles, { da = sa; })); // X static assert( __traits(compiles, { da = sa[]; })); // a static assert(!__traits(compiles, { da[] = sa; })); // X static assert( __traits(compiles, { da[] = sa[]; })); // b static assert( __traits(compiles, { da = da; })); // a == identity assign static assert( __traits(compiles, { da = da[]; })); // a static assert( __traits(compiles, { da[] = da; })); // b static assert( __traits(compiles, { da[] = da[]; })); // b bearophile says that sa = sa should be rejected and must replace it to sa[] = sa[]. But I and timon disagree it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 --- Comment #4 from timon.g...@gmx.ch 2012-02-09 07:01:17 PST --- Maybe sa[] = da and da[] = da should be '// X' too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7444] Require [] for array copies too
http://d.puremagic.com/issues/show_bug.cgi?id=7444 timon.g...@gmx.ch changed: What|Removed |Added CC||timon.g...@gmx.ch --- Comment #1 from timon.g...@gmx.ch 2012-02-05 15:34:04 PST --- While I agree that the syntax should be enforced more strictly in general, I still completely disagree with requiring [] on static array copies. Static arrays are value types of fixed size, and should be treated as such. Requiring [] is just wrong. void foo(int[4] x){} void foo(int[] y){} void main(){ int[4] x, y; struct S{int[4] x;} S a, b; x = y; a = b; // why should this work if the above does not? foo(x); // copies, you want this to be an error foo(x[]); // calls the other overload, does not copy } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---