Bug 4052 – [CTFE] increment from array item

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-04-02T14:49:00Z
Last change time
2015-06-09T05:13:44Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-04-02T14:49:25Z
(Not tested with the latest bug fixes, so this can be already fixed) int foo() { int[] arr = new int[1]; int s; foreach (x; arr) s += x; foreach (x; arr) s += x * x; return 0; } enum int _ = foo(); void main() {} dmd 2.042 gives: Error: Integer constant expression expected instead of null test.d(10): Error: cannot evaluate foo() at compile time test.d(10): Error: cannot evaluate foo() at compile time
Comment #1 by clugdbug — 2010-05-22T06:56:44Z
The patch to bug 4078 fixes this.
Comment #2 by bugzilla — 2010-05-30T16:30:37Z