Bug 6100 – [CTFE] regression: struct return values wrong if used in array initializer

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-06-03T10:34:00Z
Last change time
2011-06-11T06:44:55Z
Keywords
wrong-code
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2011-06-03T10:34:04Z
struct S { int a; } S initS(int x) { version(works) return S(x); else { S s = S(x); return s; } } static const S[2] s2 = [ initS(1), initS(2) ]; static assert(s2[0].a == 1); fails with the latest version from github with test.d(19): Error: static assert (2 == 1) is false dmd 2.053 compiles without error. enabling version "works" also works.
Comment #1 by clugdbug — 2011-06-11T06:44:55Z