www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14561] New: Large enums cannot be parsed due to too many


          Issue ID: 14561
           Summary: Large enums cannot be parsed due to too many recursive
                    template expansions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: Philip.Daniels1971 gmail.com

Created attachment 1520
  --> https://issues.dlang.org/attachment.cgi?id=1520&action=edit
Large Colors enum

I have defined a large enum to hold X11 named color values (see attachment).
The enum contains more than 500 elements. Trying to convert a string to an enum
value with

  auto c = to!Colors("AliceBlue");

fails to compile, giving:

Error: template instance
std.traits.EnumMembers!(Colors).WithIdentifier!"OliveDrab3" recursive expansion

To reproduce: dmd -unitttest color.d

Further Info
There is an existing pull request which adds a command line option to
workaround this problem which may be relevant, though I am not sure where the
"recursive" elements comes in.


I think this bug demonstrates a valid use case.

May 09 2015