Bug 6168 – Regression (2.047): Cannot create enum of struct with constructor
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-16T16:33:00Z
Last change time
2011-06-17T06:59:51Z
Keywords
rejects-valid
Assigned to
nobody
Creator
johann.macdonagh
Comments
Comment #0 by johann.macdonagh — 2011-06-16T16:33:33Z
struct Test
{
this(int a)
{
}
}
void main()
{
enum a = Test(5);
}
This compiled on 2.046 but no longer does. The error messages have changed over the versions, but current 2.053 complains:
test.d(10): Error: variable __ctmp3 cannot be read at compile time
test.d(10): Error: cannot evaluate __ctmp3.this(5) at compile time
enum a = Test();
This works fine.
Comment #1 by kennytm — 2011-06-17T00:17:00Z
Apparently fixed on git master (2.054) already before you file the bug :)
Comment #2 by kennytm — 2011-06-17T00:29:38Z
*** This issue has been marked as a duplicate of issue 5954 ***
Comment #3 by johann.macdonagh — 2011-06-17T06:59:51Z
D'oh! I searched for a duplicate before posting, so I don't know how I missed that. Perfect!