digitalmars.D.bugs - [Issue 2562] New: foreach over uninitialized array fails in CTFE
- d-bugmail puremagic.com Jan 07 2009
- d-bugmail puremagic.com Apr 06 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2562 Summary: foreach over uninitialized array fails in CTFE Product: D Version: 1.039 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: clugdbug yahoo.com.au int foo() { int [] xxx; foreach(q; xxx) {} return 1; } static assert(foo()); ---- bug.d(8): Error: cannot evaluate foo() at compile time bug.d(8): static assert (foo()) is not evaluatable at compile time Workarounds: (1) Replace the foreach with for: for (int q=0; q<xxx.length; ++q) {} (2) Initialize the array int [] xxx = []; This is NOT the same as issue 1375, which appears to be fixed. --
Jan 07 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2562 clugdbug yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from clugdbug yahoo.com.au 2009-04-06 03:01 ------- This works in DMD2.027 and DMD1.042. --
Apr 06 2009








d-bugmail puremagic.com