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".
Comment #1 by r.sagitario — 2013-07-20T05:45:08Z
Comment #2 by github-bugzilla — 2013-07-20T17:20:09Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5d18ef6b202976d8f14beb9752be741e7959e314 Merge pull request #2369 from rainers/issue10669 fix Issue 10669 - CTFE: using initialized static const class member no longer works
Comment #3 by k.hara.pg — 2013-08-25T17:44:43Z
*** Issue 10586 has been marked as a duplicate of this issue. ***