Thread overview
[Bug 135] New: typeof(x)() doesn't compile
May 11, 2006
d-bugmail
May 11, 2006
d-bugmail
Jun 29, 2006
Thomas Kuehne
May 11, 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@digitalmars.com
        ReportedBy: oskar.linde@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.


-- 

May 11, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=135





------- Comment #1 from oskar.linde@gmail.com  2006-05-11 05:38 -------
Oops, I meant to type:

struct X { static void opCall() {} }


-- 

June 29, 2006
d-bugmail@puremagic.com schrieb am 2006-05-11:
> http://d.puremagic.com/bugzilla/show_bug.cgi?id=135

> struct X { static 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.

Added to DStress as http://dstress.kuehne.cn/run/o/opCall_01_A.d http://dstress.kuehne.cn/run/o/opCall_01_B.d http://dstress.kuehne.cn/run/o/opCall_01_C.d http://dstress.kuehne.cn/run/o/opCall_01_D.d http://dstress.kuehne.cn/run/o/opCall_01_E.d http://dstress.kuehne.cn/run/o/opCall_02_A.d http://dstress.kuehne.cn/run/o/opCall_02_B.d http://dstress.kuehne.cn/run/o/opCall_02_C.d http://dstress.kuehne.cn/run/o/opCall_02_D.d http://dstress.kuehne.cn/run/o/opCall_02_E.d

Thomas