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
Comment #1 by k.hara.pg — 2014-05-28T11:00:44Z
Comment #2 by github-bugzilla — 2014-05-30T18:02:34Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dca8d48bca9994b1f0a97096c688c099f48e0673 fix Issue 12138 - Label statement creates an unexpected scope block https://github.com/D-Programming-Language/dmd/commit/6827c9a35ef013f5bcab286b0909ebe3b85bf8b6 Merge pull request #3603 from 9rnsr/fix12138 Issue 12138 - Label statement creates an unexpected scope block