www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14348] New: typeof(x).ident is not accepted as a symbol


          Issue ID: 14348
           Summary: typeof(x).ident is not accepted as a symbol
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: yebblies gmail.com

I don't see any reason why this shouldn't work:

class B
    int foo() { return 0; }

class C : B
    override int foo() { return 1; }

    alias superfoo = typeof(super).foo;
    alias thisfoo = typeof(this).foo;

void main()
    assert(&B.foo is &C.superfoo);
    assert(&C.foo is &C.thisfoo);

The current implementation requires the typeof(a).b expression evaluates to
both a type and a symbol, when only a symbol is required.

Mar 27 2015