digitalmars.D.bugs - [Issue 6511] New: [CTFE] Array op gives wrong result
- d-bugmail puremagic.com (30/30) Aug 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6511
- d-bugmail puremagic.com (12/12) Aug 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6511
- d-bugmail puremagic.com (22/22) Aug 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6511
- d-bugmail puremagic.com (17/40) Aug 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6511
- d-bugmail puremagic.com (7/8) Aug 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6511
http://d.puremagic.com/issues/show_bug.cgi?id=6511 Summary: [CTFE] Array op gives wrong result Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2011-08-16 13:49:05 PDT --- T foo(T)() { T[1] a = [1]; a[] += a[]; return a[0]; } static assert(foo!ulong() == 2); // error static assert(foo!long() == 2); // error void main() { assert(foo!ulong() == 2); // OK assert(foo!long() == 2); // OK } DMD gives: test.d(6): Error: static assert (1LU == 2LU) is false -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6511 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2011-08-22 22:47:12 PDT --- https://github.com/D-Programming-Language/dmd/commit/563a291a5c7757fca87685909afa37100e3b44f6 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 22 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6511 --- Comment #2 from bearophile_hugs eml.cc 2011-08-22 23:21:42 PDT --- The given code example now works. But this: T foo(T)() { T[1] a = [1]; a[] += a[]; return a[0]; } static assert(foo!long() == 2); // OK static assert(foo!int() == 2); // error void main() {} Gives: test.d(3): Error: _arraySliceSliceAddass_i cannot be interpreted at compile time, because it has no available source code test.d(7): Error: cannot evaluate foo() at compile time test.d(7): Error: static assert (foo() == 2) is not evaluatable at compile time This behaviour difference between long and int is not good. Do you prefer me to reopen this bug or to open a new one? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 22 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6511 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au --- Comment #3 from Don <clugdbug yahoo.com.au> 2011-08-23 01:29:13 PDT --- (In reply to comment #2)The given code example now works. But this: T foo(T)() { T[1] a = [1]; a[] += a[]; return a[0]; } static assert(foo!long() == 2); // OK static assert(foo!int() == 2); // error void main() {} Gives: test.d(3): Error: _arraySliceSliceAddass_i cannot be interpreted at compile time, because it has no available source code test.d(7): Error: cannot evaluate foo() at compile time test.d(7): Error: static assert (foo() == 2) is not evaluatable at compile time This behaviour difference between long and int is not good. Do you prefer me to reopen this bug or to open a new one?A new one. Surprisingly, it actually has *nothing* in common with this bug. This bug was actually a problem with array slicing, and didn't require array operations. The new case is that the array operations which are special-cased in the runtime don't have special case treatment in the CTFE engine, since CTFE doesn't have access to the source code of druntime. The array ops which aren't special-cased don't use druntime code, so they should all work. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6511 --- Comment #4 from bearophile_hugs eml.cc 2011-08-23 02:10:18 PDT --- (In reply to comment #3)A new one.OK. It is bug 6545 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 23 2011