Bug 1948 – CTFE fails when mutating a struct in an array

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-03-26T12:47:00Z
Last change time
2014-02-24T15:32:33Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
samukha

Comments

Comment #0 by samukha — 2008-03-26T12:47:43Z
Error: cannot evaluate foo() at compile time struct S { int x; } int foo() { S[] a = []; a ~= S(); a[0].x = 1; // Fails return 0; } enum x = foo(); Btw, CTFE is relatively difficult to debug. More informative messages than "cannot evaluate ... at compile time" would be appreciated.
Comment #1 by clugdbug — 2009-02-19T07:04:04Z
This applies to D1.0 as well. For D1.0, change last line of test case to: int x = foo();
Comment #2 by clugdbug — 2009-07-24T02:21:17Z
Patch included in patch for bug#2569.
Comment #3 by bugzilla — 2009-09-03T13:23:18Z
Fixed dmd 1.047 and 2.032