www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19420] New: [master] TypeTrait semantic fails for non static


          Issue ID: 19420
           Summary: [master] TypeTrait semantic fails for non static
                    aggregate members
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

With DMD ~master

alias Seq(T...) = T;

class One
    int foo;
    void test()
        alias p1 = Seq!(__traits(getMember, this, "foo"))[0];
        alias p2 = __traits(getMember, this, "foo");
        static assert(__traits(isSame, p1, p2));

void main(){}   


Error: static assert:  `__traits(isSame, foo, int)` is false

with the new syntax `foo` is replaced by to its type:

TypeTrait semantic tries getSymbol() on the trait. If this fails, it calls
getType() which takes the type of the expression when this expression is not a

There's something missing to transform the trait in dsymbol before it falls
back to getType()

Nov 21 2018