On Tuesday, 28 May 2013 at 16:38:50 UTC, Kenji Hara wrote:
I think this is a corner case bug of current dmd parser.

Kenji Hara

It's not a corner case. It's the spec.

It's a "LabeledStatement" : "NoScopeStatement"
http://dlang.org/statement.html#LabeledStatement

I was finally able to track down the original bug report, from really long ago:

"Label causes scope to collapse into parent"
http://d.puremagic.com/issues/show_bug.cgi?id=199

It was closed as "won't fix" by Walter:
http://d.puremagic.com/issues/show_bug.cgi?id=199#c6

Walter Bright 2008-06-23 17:00:19 PDT

Since the compiler is behaving according to spec, I don't want to change this because it could break existing code, and there doesn't seem to be a compelling reason to do so.

Walter Bright 2008-06-23 17:29:31 PDT

The test case behaves as expected, because labels do not introduce a new scope when followed by { }.

I hope I just provided a compelling reason why this is bad
behavior. And I don't think we'd break anything)

Reply via email to