Thread overview
[Issue 10669] New: CTFE: using initialized static const class member no longer works
Jul 19, 2013
Rainer Schuetze
Jul 20, 2013
Rainer Schuetze
Jul 21, 2013
Walter Bright
Aug 26, 2013
Kenji Hara
July 19, 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@puremagic.com
        ReportedBy: r.sagitario@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario@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: -------
July 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10669



--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2013-07-20 05:45:08 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2369

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 21, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10669



--- Comment #2 from github-bugzilla@puremagic.com 2013-07-20 17:20:09 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 21, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10669


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 26, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10669


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |puneet@coverify.org


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-08-25 17:44:43 PDT ---
*** Issue 10586 has been marked as a duplicate of this issue. ***

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