[Bug 31] New: Keyword 'function' and pointer test broken for IsExpression
Thomas Kuehne
thomas-dloop at kuehne.cn
Wed Mar 15 00:46:56 PST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail at puremagic.com schrieb am 2006-03-10:
> Given the documentation, I would expect all eight tests to pass, yet tests six
> and eight both fail.
>
>
> C:\code\d\bugs>type 149_1.d
> import std.c.stdio;
>
> template isPointer( T )
> {
> const bool isPointer = is( T : T* );
> }
>
> void main()
> {
> struct S {}
> union U {}
> class C {}
> interface I {}
> enum E { e }
> alias void function() fp;
> alias void delegate() dp;
>
> static if( is( S == struct ) ) printf( "1. struct passes\n" );
> static if( is( U == union ) ) printf( "2. union passes\n" );
> static if( is( C == class ) ) printf( "3. class passes\n" );
> static if( is( I == interface ) ) printf( "4. interface passes\n" );
> static if( is( E == enum ) ) printf( "5. enum passes\n" );
> static if( is( fp == function ) ) printf( "6. function passes\n" );
> static if( is( dp == delegate ) ) printf( "7. delegate passes\n" );
> static if( isPointer!(int*) ) printf( "8. pointer passes\n" );
> }
> C:\code\d\bugs>dmd 149_1.d
> C:\bin\dmd\bin\..\..\dm\bin\link.exe 149_1,,,user32+kernel32/noi;
>
> C:\code\d\bugs>149_1
> 1. struct passes
> 2. union passes
> 3. class passes
> 4. interface passes
> 5. enum passes
> 7. delegate passes
Shouldn't isPointer be defined as:
# template isPointer( T ){
# const bool isPointer = is( T : void* );
# }
http://www.digitalmars.com/d/expression.html#IsExpression
# is ( Type : TypeSpecialization )
# The condition is satisfied if Type is semantically correct and it is
# the same as or can be implicitly converted to TypeSpecialization.
Thus "is(T : T*)" is always false.
Added to DStress as
http://dstress.kuehne.cn/run/i/is_05_A.d
http://dstress.kuehne.cn/run/i/is_05_B.d
http://dstress.kuehne.cn/run/i/is_05_C.d
http://dstress.kuehne.cn/run/i/is_05_D.d
http://dstress.kuehne.cn/run/i/is_05_E.d
http://dstress.kuehne.cn/run/i/is_05_F.d
http://dstress.kuehne.cn/run/i/is_05_G.d
http://dstress.kuehne.cn/run/i/is_05_H.d
http://dstress.kuehne.cn/run/i/is_06_A.d
http://dstress.kuehne.cn/run/i/is_06_B.d
http://dstress.kuehne.cn/run/i/is_06_C.d
http://dstress.kuehne.cn/run/i/is_06_D.d
http://dstress.kuehne.cn/run/i/is_06_E.d
http://dstress.kuehne.cn/run/i/is_06_F.d
http://dstress.kuehne.cn/run/i/is_06_G.d
http://dstress.kuehne.cn/run/i/is_06_H.d
http://dstress.kuehne.cn/run/i/is_07_A.d
http://dstress.kuehne.cn/run/i/is_07_B.d
http://dstress.kuehne.cn/run/i/is_07_C.d
http://dstress.kuehne.cn/run/i/is_07_D.d
http://dstress.kuehne.cn/run/i/is_07_E.d
http://dstress.kuehne.cn/run/i/is_07_F.d
http://dstress.kuehne.cn/run/i/is_07_G.d
http://dstress.kuehne.cn/run/i/is_07_H.d
http://dstress.kuehne.cn/run/i/is_08_A.d
http://dstress.kuehne.cn/run/i/is_08_B.d
http://dstress.kuehne.cn/run/i/is_08_C.d
http://dstress.kuehne.cn/run/i/is_08_D.d
http://dstress.kuehne.cn/run/i/is_08_E.d
http://dstress.kuehne.cn/run/i/is_08_F.d
http://dstress.kuehne.cn/run/i/is_08_G.d
http://dstress.kuehne.cn/run/i/is_08_H.d
http://dstress.kuehne.cn/run/i/is_09_A.d
http://dstress.kuehne.cn/run/i/is_09_B.d
http://dstress.kuehne.cn/run/i/is_09_C.d
http://dstress.kuehne.cn/run/i/is_09_D.d
http://dstress.kuehne.cn/run/i/is_09_E.d
http://dstress.kuehne.cn/run/i/is_09_F.d
http://dstress.kuehne.cn/run/i/is_09_G.d
http://dstress.kuehne.cn/run/i/is_09_H.d
http://dstress.kuehne.cn/run/i/is_10_A.d
http://dstress.kuehne.cn/run/i/is_10_B.d
http://dstress.kuehne.cn/run/i/is_10_C.d
http://dstress.kuehne.cn/run/i/is_10_D.d
http://dstress.kuehne.cn/run/i/is_10_E.d
http://dstress.kuehne.cn/run/i/is_10_F.d
http://dstress.kuehne.cn/run/i/is_10_G.d
http://dstress.kuehne.cn/run/i/is_10_H.d
http://dstress.kuehne.cn/run/i/is_11_A.d
http://dstress.kuehne.cn/run/i/is_11_B.d
http://dstress.kuehne.cn/run/i/is_11_C.d
http://dstress.kuehne.cn/run/i/is_11_D.d
http://dstress.kuehne.cn/run/i/is_11_E.d
http://dstress.kuehne.cn/run/i/is_11_F.d
http://dstress.kuehne.cn/run/i/is_11_G.d
http://dstress.kuehne.cn/run/i/is_11_H.d
http://dstress.kuehne.cn/run/i/is_12_A.d
http://dstress.kuehne.cn/run/i/is_12_B.d
http://dstress.kuehne.cn/run/i/is_12_C.d
http://dstress.kuehne.cn/run/i/is_12_D.d
http://dstress.kuehne.cn/run/i/is_12_E.d
http://dstress.kuehne.cn/run/i/is_12_F.d
http://dstress.kuehne.cn/run/i/is_12_G.d
http://dstress.kuehne.cn/run/i/is_12_H.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFEF+Hc3w+/yD4P9tIRAgIbAJ48xca4iWYt1eWGLX4PDQe/mo3TkwCgka6x
f0HGCToN9r63VP1tHakuLaU=
=m1gS
-----END PGP SIGNATURE-----
More information about the Digitalmars-d-bugs
mailing list