www.digitalmars.com         C & C++   DMDScript  

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


          Issue ID: 23241
           Summary: __traits getMember breaks compilation when hit an
           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;

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