www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23105] New: `__trait(getMember)` and `mixin()` of the same

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

          Issue ID: 23105
           Summary: `__trait(getMember)` and `mixin()` of the same code as
                    a string behaves differently
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

```
module self;

enum getMember = `__traits(getMember, sym, m)`;

template test(alias sym)
{
    static foreach (m; __traits(allMembers, sym))
    {
        static if (is(__traits(getMember, sym, m)==module))
            static assert(0);   // pass
        static if (is(mixin(getMember)==module))
            static assert(0);   // fails
    }
}

void main()
{
    alias _ = test!(self);
}       
```

the first static assert should fail the condition is the same as the second.

--
May 12 2022