static assert fouls up template promotion when between static if statements.

Thomas Kuehne thomas-dloop at kuehne.cn
Thu Feb 23 23:32:01 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Don Clugston schrieb am 2006-02-22:
> If you uncomment the indicated line, it won't compile.
> (The fact that the others will compile is a really nice feature from DMD 
> 0.146).
> Note that a failed template promotion can easily send the compiler into 
> an error message orgy, which you unfortunately can't break out of with ^C.
>
> template cat()
> {
>      static assert(1);  // OK
>      static if (1) {
> //       static assert(1); // doesn't work
>         static if (1) {
>              static assert(1);  // OK
>              const int cat = 3;
>         }
>      }
> }
>
> void main() {
>   const int a = cat!();
> }

Added to DStress as
http://dstress.kuehne.cn/compile/a/assert_14_A.d
http://dstress.kuehne.cn/nocompile/a/assert_14_B.d
http://dstress.kuehne.cn/nocompile/a/assert_14_C.d
http://dstress.kuehne.cn/compile/a/assert_14_D.d
http://dstress.kuehne.cn/compile/a/assert_14_E.d
http://dstress.kuehne.cn/nocompile/a/assert_14_F.d
http://dstress.kuehne.cn/compile/a/assert_14_G.d
http://dstress.kuehne.cn/nocompile/a/assert_14_H.d
http://dstress.kuehne.cn/nocompile/a/assert_14_I.d
http://dstress.kuehne.cn/compile/a/assert_14_J.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFD/iCQ3w+/yD4P9tIRAnRSAJ9qx5QvutmlpjFg3Vvh3vJHe1jEyQCfVkxU
BI5DyF8FOY89q6VS4GO3w1o=
=JTHS
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list