www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10530] New: Initializers inside named enum declarations cannot forward reference other members

reply d-bugmail puremagic.com writes:
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



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: -------
Jul 03 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10530




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: -------
Jul 03 2013
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 03 2013