[Issue 380] New: cannot use typeof(*this) in a static context
Thomas Kuehne
thomas-dloop at kuehne.cn
Fri Sep 29 00:04:07 PDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail at puremagic.com schrieb am 2006-09-27:
> http://d.puremagic.com/issues/show_bug.cgi?id=380
> struct Foo {
> alias typeof(*this) ThisType;
> }
>
>
>> 'this' is only allowed in non-static member functions
>> can only * a pointer, not a 'int'
>
>
>
> workaround:
>
> struct Foo {
> alias typeof(*typeof(this).init) ThisType;
> static assert (is(Foo == ThisType));
> }
Added to DStress as
http://dstress.kuehne.cn/compile/t/typeof_10_A.d
http://dstress.kuehne.cn/compile/t/typeof_10_B.d
http://dstress.kuehne.cn/compile/t/typeof_10_C.d
http://dstress.kuehne.cn/compile/t/typeof_10_D.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFFHDPELK5blCcjpWoRAqm+AJ4jqtlQEQkV9fgRzRJXIiHDmaPcewCdHewk
7VoXDtrrI5FWYnS+LQgrKZ8=
=rMNb
-----END PGP SIGNATURE-----
More information about the Digitalmars-d-bugs
mailing list