[Bug 135] New: typeof(x)() doesn't compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 11 03:37:21 PDT 2006


http://d.puremagic.com/bugzilla/show_bug.cgi?id=135

           Summary: typeof(x)() doesn't compile
           Product: D
           Version: 0.156
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: oskar.linde at gmail.com


struct X { void opCall() {} }

X x;
typeof(x)(); // Error: found '(' when expecting '.' following 'typeof(x)'

Workarounds:

1. typeof(x).opCall();
2. template T(_T) { alias _T T; }  T!(typeof(x))();
3. template mytypeof(alias x) { alias typeof(x) mytypeof; } mytypeof!(x)(); //
For globally/statically declared X.


-- 




More information about the Digitalmars-d-bugs mailing list