[Issue 14561] New: Large enums cannot be parsed due to too many recursive template expansions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 9 09:15:08 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14561

          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 at puremagic.com
          Reporter: Philip.Daniels1971 at 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.

https://github.com/D-Programming-Language/dmd/pull/3708

I think this bug demonstrates a valid use case.

--


More information about the Digitalmars-d-bugs mailing list