[Issue 10669] New: CTFE: using initialized static const class member no longer works

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 19 02:23:37 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10669

           Summary: CTFE: using initialized static const class member no
                    longer works
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2013-07-19 02:23:36 PDT ---
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".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list