Bug 5222 – label prepending block in 'ThenStatement' breaks creating new scope
Status
RESOLVED
Resolution
WORKSFORME
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-11-16T07:17:00Z
Last change time
2015-06-09T05:11:58Z
Assigned to
nobody
Creator
elfy.nv
Comments
Comment #0 by elfy.nv — 2010-11-16T07:17:46Z
//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 by yebblies — 2013-11-16T23:03:14Z
Fixed now, there was a bug with if/mixin that was probably the same root cause.