[Issue 305] New: version and static if blocks introduce new scope for 'scope' statement
Thomas Kuehne
thomas-dloop at kuehne.cn
Fri Aug 25 04:50:37 PDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail at puremagic.com schrieb am 2006-08-23:
> http://d.puremagic.com/issues/show_bug.cgi?id=305
> According to the documentation for version blocks, "no new scope is introduced,
> even if the DeclarationBlock or Statement is enclosed by { }." And the docs
> for static if say "it does not introduce a new scope even if { } are used for
> conditionally compiled statements." However, this code:
>
> void main()
> {
> version( all )
> {
> scope( exit ) printf( "version exit\n" );
> }
> static if( true )
> {
> scope( exit ) printf( "if exit\n" );
> }
> printf( "main\n" );
> }
>
> Produces this output:
>
> version exit
> if exit
> main
>
> When I expect:
>
> main
> if exit
> version exit
Added to DStress as
http://dstress.kuehne.cn/run/v/version_38_A.d
http://dstress.kuehne.cn/run/v/version_38_B.d
http://dstress.kuehne.cn/run/v/version_38_C.d
http://dstress.kuehne.cn/run/v/version_38_D.d
http://dstress.kuehne.cn/run/v/version_38_E.d
http://dstress.kuehne.cn/run/s/static_if_07_A.d
http://dstress.kuehne.cn/run/s/static_if_07_B.d
http://dstress.kuehne.cn/run/s/static_if_07_C.d
http://dstress.kuehne.cn/run/s/static_if_07_D.d
http://dstress.kuehne.cn/run/s/static_if_07_E.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFE7uYQLK5blCcjpWoRAvVaAJ9GX6hfQrSN09bMoiwUF2fzZAmc9wCcCMbb
YF41KGZDMBSclrhyPmCBqXM=
=Ynxt
-----END PGP SIGNATURE-----
More information about the Digitalmars-d-bugs
mailing list