[Issue 21732] New: Enum member UDAs compilation is order dependant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 19 09:55:03 UTC 2021


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

          Issue ID: 21732
           Summary: Enum member UDAs compilation is order dependant
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: eyal at weka.io

import std;

struct s {}
enum X : ubyte { @s A }

void failsToBuild() {
    // getUDAs!(X.A, s) compiles iff it appears *after* __traits(getAttributes,
X.A)
    // i.e: Reverse the order of these 2 pragma msg statements and it builds!
    pragma(msg, getUDAs!(X.A, s));
    pragma(msg, __traits(getAttributes, X.A));
}

void compiles() {
    pragma(msg, __traits(getAttributes, X.A));
    pragma(msg, getUDAs!(X.A, s));
}

--


More information about the Digitalmars-d-bugs mailing list