Thread overview
[Issue 10530] New: Initializers inside named enum declarations cannot forward reference other members
Jul 03, 2013
timon.gehr@gmx.ch
Jul 03, 2013
timon.gehr@gmx.ch
Jul 03, 2013
Andrej Mitrovic
July 03, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10530

           Summary: Initializers inside named enum declarations cannot
                    forward reference other members
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: timon.gehr@gmx.ch


--- Comment #0 from timon.gehr@gmx.ch 2013-07-03 09:48:00 PDT ---
DMD 2.063/git head:

enum X {foo=0, bar=foo} // ok
enum Y {foo=bar, bar=0} // error

Both lines should compile.

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



--- Comment #1 from timon.gehr@gmx.ch 2013-07-03 13:24:07 PDT ---
Actually it might be fine for the second line to be in error, since the compiler cannot easily figure out the enum base type in the general case when such a constellation is present.

This should certainly work though:

enum Y : int {foo=bar, bar=0}

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


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-07-03 13:46:36 PDT ---
However this shouldn't work:

enum Y : int {foo=bar, bar}

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