www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21732] New: Enum member UDAs compilation is order dependant

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 puremagic.com
          Reporter: eyal 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));
}

--
Mar 19 2021