Bug 1565 – ctfe compile-time function fails when the type of a struct member is a struct with multiple members

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-10-09T23:52:00Z
Last change time
2014-02-24T15:32:15Z
Keywords
rejects-valid
Assigned to
nobody
Creator
gamerChad

Comments

Comment #0 by gamerChad — 2007-10-09T23:52:01Z
Here's the example: struct B { int z = 5; int w = 4; // remove this line and it compiles fine. } struct A { B y; } int crash() { A x; return x.y.z; } const foo = crash(); void main() {}; When compiled, this yields the following error: main.d(18): Error: cannot evaluate crash() at compile time This happened with DMD 1.022 and 1.021, on Windows XP, with both Phobos and Tango.
Comment #1 by samukha — 2008-04-10T02:34:20Z
Increasing the severity because workarounds are ugly and will be pain to clean up after the bug is fixed. The bug is also present in DMD 2.012
Comment #2 by clugdbug — 2009-07-24T04:48:22Z
This works for me on both D1 and D2.
Comment #3 by clugdbug — 2009-08-17T02:39:32Z
I have confirmed that this bug existed in DMD1.020, but was fixed by 1.041.