digitalmars.D.bugs - [Issue 5606] New: [CTFE] filter(iota) minus enforce
- d-bugmail puremagic.com (48/48) Feb 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5606
- d-bugmail puremagic.com (7/7) Feb 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5606
- d-bugmail puremagic.com (20/20) Jun 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5606
http://d.puremagic.com/issues/show_bug.cgi?id=5606 Summary: [CTFE] filter(iota) minus enforce Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2011-02-17 14:48:06 PST --- In attach there is a CTFE bug I don't understand, dmd 2.052beta. I have reduced it from Phobos filter() and iota() code, but it's about one hundred lines still. This main doesn't compile: void main() { auto odds = filter!isOdd(iota(0, 10, 1)); auto b1 = foo!isOdd(iota(0, 10, 1)); // OK enum b2 = foo!isOdd(iota(0, 10, 1)); // Error } This compiles: void main() { auto b1 = foo!isOdd(iota(0, 10, 1)); enum b2 = foo!isOdd(iota(0, 10, 1)); } This too: void main() { auto b1 = foo!isOdd(iota(0, 10, 1)); enum b2 = foo!isOdd(iota(0, 10, 1)); auto odds = filter!isOdd(iota(0, 10, 1)); } This too: void main() { auto odds = filter!isOdd(iota(0, 10, 1)); auto b1 = foo!isOdd(iota(0, 10, 1)); } In a bit more longer version of the code, removing this produced a stack overflow (not anymore), so the cause may be isInfinite or isInputRange: static if (isInfinite!Range) { (Beside killing inlining, reducing performance, and not allowing the nothrow tag, the enforce() also makes a function not fit for CTFE. Here I have commented out the enforce()). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5606 --- Comment #1 from bearophile_hugs eml.cc 2011-02-17 14:49:08 PST --- Created an attachment (id=914) filter(iota) minus enforce, reduced in many ways -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5606 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |DUPLICATE --- Comment #2 from Don <clugdbug yahoo.com.au> 2011-06-07 01:23:06 PDT --- Reduced test case: ------------- struct Bug5606 { bool empty(){ return true; } } static assert(!is(char[1 + Bug5606.empty])); static assert(Bug5606().empty()); It's a dup of bug 4910 which is fixed in git. *** This issue has been marked as a duplicate of issue 4910 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 07 2011