digitalmars.D.bugs - [Issue 6419] New: [CTFE] Cannot create a struct if it has a constructor (may cause ICE)
- d-bugmail puremagic.com (59/59) Jul 31 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6419
- d-bugmail puremagic.com (10/10) Aug 11 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6419
- d-bugmail puremagic.com (11/11) Aug 11 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6419
- d-bugmail puremagic.com (13/13) Aug 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6419
- d-bugmail puremagic.com (10/10) Sep 29 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6419
- d-bugmail puremagic.com (25/25) Dec 29 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6419
- d-bugmail puremagic.com (23/23) Jul 02 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6419
- d-bugmail puremagic.com (12/12) Feb 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6419
http://d.puremagic.com/issues/show_bug.cgi?id=6419 Summary: [CTFE] Cannot create a struct if it has a constructor (may cause ICE) Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Keywords: ice-on-valid-code, rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: kennytm gmail.com --- Comment #0 from kennytm gmail.com 2011-07-31 15:54:28 PDT --- Test case 1: ---------------------- static assert({ struct Result { this(int x) {} } auto x = Result(1); // <-- line 5 return true; }()); ---------------------- x.d(5): Error: CTFE internal error assigning struct x.d(7): Error: cannot evaluate delegate system bool() { struct Result { this(int x) { return this; } void* this; } Result x = x = 0 , x.this(1); return true; } () at compile time ... ---------------------- Test case 2 (causes ICE): ---------------------- static assert(({ struct Result { this(int x) {} } return Result(1); }(), true)); ---------------------- x.d(6): Error: CTFE internal error assigning struct Bus error: 10 ---------------------- This bug affects using std.algorithm.map in CTFE, although I don't see any point keeping that constructor any more. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 31 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6419 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmitry.olsh gmail.com --- Comment #1 from Don <clugdbug yahoo.com.au> 2011-08-11 23:39:26 PDT --- *** Issue 6460 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 11 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6419 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au --- Comment #2 from Don <clugdbug yahoo.com.au> 2011-08-11 23:43:40 PDT --- This is because if the struct is nested, TypeStruct::defaultInitLiteral() doesn't return a literal! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 11 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6419 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-valid-code | Summary|[CTFE] Cannot create a |[CTFE] Cannot create a |nested struct if it has a |nested struct if it has a |constructor (may cause ICE) |constructor --- Comment #3 from Don <clugdbug yahoo.com.au> 2011-08-23 13:31:26 PDT --- The bug which caused an ICE was independent to this one, and has been fixed. -- 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=6419 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc --- Comment #4 from Don <clugdbug yahoo.com.au> 2011-09-29 01:21:18 PDT --- *** Issue 6653 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 29 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6419 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[CTFE] Cannot create a |[CTFE] Cannot create a |nested struct if it has a |non-static nested struct |constructor | OS/Version|Mac OS X |All --- Comment #5 from Don <clugdbug yahoo.com.au> 2011-12-29 02:50:58 PST --- Actually, it doesn't need a constructor. The presence of _any_ member function triggers the bug: static assert({ struct Result { void foo(){} } Result x; return true; }()); If it doesn't have any member functions, then it is actually a static nested struct. So true nested structs are never supported in CTFE. It's because the hidden member of the struct needs a pointer to the enclosing function, and this is not implemented. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 29 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6419 ponce <aliloko gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aliloko gmail.com --- Comment #6 from ponce <aliloko gmail.com> 2012-07-02 12:32:26 PDT --- This is sad because you can't do compile-time FizzBuzz :) ------------------- import std.stdio, std.conv, std.range, std.algorithm; void main() { enum fizzbuzz = iota(1, 100) .map!(x => (0 == x % 15) ? "FizzBuzz" : (0 == x % 5) ? "Buzz" : (0 == x % 3) ? "Fizz" : to!string(x)) .joiner("\n"); writeln(fizzbuzz); } ------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 02 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6419 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |WORKSFORME --- Comment #7 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-08 15:17:48 PST --- All the test-case provided here work in 2.061. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 08 2013