[Issue 15326] New: False positive for dangling else warning
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Nov 13 03:24:03 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15326
Issue ID: 15326
Summary: False positive for dangling else warning
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: mathias.lang at sociomantic.com
```
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.
--
More information about the Digitalmars-d-bugs
mailing list