D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5222 - label prepending block in 'ThenStatement' breaks creating new scope
Summary: label prepending block in 'ThenStatement' breaks creating new scope
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-16 07:17 UTC by Nick Voronin
Modified: 2015-06-09 05:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nick Voronin 2010-11-16 07:17:46 UTC
//case 1
{
l1: {
 int v;
}
v = 5; // works, block after label does not introduce new scope
}

// case 2
{
while(1)
l2: {
 int v;
}
v = 5; // error, v is undefined, seems correct as 
// WhileStatement:
//    while ( Expression ) ScopeStatement
}

// case 3
{
if(1)
l3: {
 int v;
}
v = 5; // works! seems inconsistent and incorrect as 
// ThenStatement:
//	ScopeStatement
}
Comment 1 yebblies 2013-11-16 23:03:14 UTC
Fixed now, there was a bug with if/mixin that was probably the same root cause.