www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 135] New: typeof(x)() doesn't compile

reply d-bugmail puremagic.com writes:
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
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=135






Oops, I meant to type:

struct X { static void opCall() {} }


-- 
May 11 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFEolu/3w+/yD4P9tIRAvDzAKCuD/QjAstK4mySw6Zsr+OuBlWrSQCgtG5H CFLO1H8pjNbwnnka1NGh8Wk= =hW9g -----END PGP SIGNATURE-----
Jun 29 2006