www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5222] New: label prepending block in 'ThenStatement' breaks creating new scope

http://d.puremagic.com/issues/show_bug.cgi?id=5222

           Summary: label prepending block in 'ThenStatement' breaks
                    creating new scope
           Product: D
           Version: D1 & D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: elfy.nv gmail.com



//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
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 16 2010