Bug 10669 – CTFE: using initialized static const class member no longer works
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-19T02:23:00Z
Last change time
2013-08-25T17:44:43Z
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0 by r.sagitario — 2013-07-19T02:23:36Z
This code used to compile until recently:
///////////////////////////
struct S { uint x; }
static const S iid0 = S(0);
class C
{
static const S iid1 = S(1);
};
const S IID0 = iid0; // works
const S IID1 = C.iid1; // Line 11: fails
////////////////////////////
current git head now reports:
test.d(7): Error: cannot evaluate S(1) at compile time. Circular reference?
test.d(11): while evaluating iid1.init
I guess this is related to changes regarding const class members. IIRC the code should still work if an initializer exists.
As a side note, I think the error message should not report "cannot evaluate S(1)", but "cannot evaluate iid1".