← Back to index
|
Original Bugzilla link
Bug 135 – typeof(x)() doesn't compile
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-05-11T05:37:00Z
Last change time
2014-02-15T13:20:38Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
oskar.linde
Comments
Comment #0
by oskar.linde — 2006-05-11T05:37:20Z
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.
Comment #1
by oskar.linde — 2006-05-11T05:38:25Z
Oops, I meant to type: struct X { static void opCall() {} }
Comment #2
by thomas-dloop — 2006-06-29T08:40:32Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
[email protected]
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-----
Comment #3
by bugzilla — 2006-06-30T20:23:09Z
Fixed DMD 0.162
Comment #4
by davidl — 2008-07-02T10:49:44Z
http://dstress.kuehne.cn/run/o/opCall_02_C.d
still not passes the test?
Comment #5
by gide — 2008-09-08T07:43:13Z
opCall_02_C.d has a bug, there is a extra bracket around typeof(x) which makes the expression into a c-style cast. if((typeof(x))() != 3){ // incorrect if(typeof(x)() != 3){ // correct
Comment #6
by kamm-removethis — 2008-09-09T09:43:43Z
opCall_02_C is fixed in dsource-dstress rev 1596