← Back to index
|
Original Bugzilla link
Bug 15326 – False positive for dangling else warning
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-13T11:24:00Z
Last change time
2016-10-01T11:47:24Z
Keywords
rejects-valid
Assigned to
nobody
Creator
mathias.lang
Comments
Comment #0
by mathias.lang — 2015-11-13T11:24:03Z
``` version (unittest) private struct _NestedSym_ { static if ((void*).sizeof == 8) { pragma(msg, "64"); } else { pragma(msg, "32"); } version (X86_64) { pragma(msg, "X86_64"); } else { pragma(msg, "Not 64"); } } ``` ``` % dmd -unittest -c -w test.d test.d(8): Warning: else is dangling, add { } after condition at test.d(2) test.d(17): Warning: else is dangling, add { } after condition at test.d(2) ``` Using `version(unittest):` makes the warning vanish. Tested in both 2.066 and 2.069.
Comment #1
by github-bugzilla — 2016-06-03T20:33:02Z
Commits pushed to master at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/56574950f12ed955c480fcda5b4f6564ec4af868
Fix issue 15326 - False positive for dangling else warning
https://github.com/dlang/dmd/commit/7259efd33b7032c9e9da597309591d85661047bc
Merge pull request #5838 from mathias-lang-sociomantic/fix-15326 Fix issue 15326 - False positive for dangling else warning
Comment #2
by issues.dlang — 2016-07-30T19:11:32Z
Whoops. Sorry. I edited the wrong bug. Too many tabs open, I guess...
Comment #3
by github-bugzilla — 2016-10-01T11:47:24Z
Commits pushed to stable at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/56574950f12ed955c480fcda5b4f6564ec4af868
Fix issue 15326 - False positive for dangling else warning
https://github.com/dlang/dmd/commit/7259efd33b7032c9e9da597309591d85661047bc
Merge pull request #5838 from mathias-lang-sociomantic/fix-15326