[Issue 305] New: version and static if blocks introduce new scope for 'scope' statement
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 22 22:11:40 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=305
Summary: version and static if blocks introduce new scope for
'scope' statement
Product: D
Version: 0.165
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: sean at f4.ca
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
--
More information about the Digitalmars-d-bugs
mailing list