www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12138] New: Label statement creates an unexpected scope block

https://d.puremagic.com/issues/show_bug.cgi?id=12138

           Summary: Label statement creates an unexpected scope block
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jiki red.email.ne.jp



Running this code fails at the second enforce().


import std.exception;
void main() {
label: // works if the label is removed 
    scope ea = enforce(new Exception("test"), "first");
    enforce(ea, "second"); // fails here
}

I guess that the label statement internally creates a scope block which is
unexpected and that ea gets to point to something wrong.

Tested: dmd 2.065 beta 3

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014