[Issue 22981] New: Another forward reference bug involving a string mixin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 4 07:42:17 UTC 2022


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

          Issue ID: 22981
           Summary: Another forward reference bug involving a string mixin
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxsamukha at gmail.com

A reduced test case:

mixin ("enum E {", S.attr, "}");

struct S
{
    E e;
    enum attr = "a";
}

void main()
{
}

onlineapp.d(7): Error: undefined identifier `E`


The test case compiles if the enum is wrapped in a template:

template E()
{
    mixin ("enum E {", S.attr, "}");
}

struct S
{
    E!() e;
    enum attr = "a";
}

--


More information about the Digitalmars-d-bugs mailing list