Bug 12138 – Label statement creates an unexpected scope block
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2014-02-12T03:58:00Z
Last change time
2014-05-30T18:02:35Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
jiki
Comments
Comment #0 by jiki — 2014-02-12T03:58:37Z
Running this code fails at the second enforce().
# 'Exception' may be any other class.
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