www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23241] New: __traits getMember breaks compilation when hit an

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

          Issue ID: 23241
           Summary: __traits getMember breaks compilation when hit an
                    alias
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ryuukk.dev gmail.com

```
onlineapp.d(12): Error: first argument is not a symbol
```

```
module a;
import std;

 ("hi")
void main()
{    
    alias THIS_MODULE = a;
    static foreach (member; __traits(allMembers, THIS_MODULE))
    {
        writeln("member: ", member);
        static foreach (attr; __traits(getAttributes, __traits(getMember,
THIS_MODULE, member))) 
        {
            writeln("\tattribute: ", attr);
        }
    }
}

enum :int
{
    A, B, C
}

// commenting this out fixes it
alias MyEnum = int;
``` 

Expected behavior:

It should ignore either ignore the alias and compile, or support the alias

--
Jul 12 2022