[Issue 199] New: Label causes scope to collapse into parent
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jun 16 13:05:07 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=199
Summary: Label causes scope to collapse into parent
Product: D
Version: 0.160
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: ericanderton at yahoo.com
When using a label directly before an anonymous scope (set of curly brackets),
it causes the anonymous scope to behave as though its contents are declared in
the parent scope directly. This causes variable names to collide should they
share the same name between child and parent:
void main(){
uint foo;
x:
{
uint foo;
}
}
test.d(5): declaration test.main.foo is already defined
Adding '{}' immediately after the label seems to be a viable workaround.
--
More information about the Digitalmars-d-bugs
mailing list