[Issue 15166] New: [Ref 2.069-devel] spurious statement not reachable warning in static foreach loop
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 5 23:43:18 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15166
Issue ID: 15166
Summary: [Ref 2.069-devel] spurious statement not reachable
warning in static foreach loop
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > bug.d << CODE
template Group(T...)
{
alias expand = T;
}
private bool compare(alias Group1, alias Group2)()
{
foreach (index, element; Group1.expand)
{
static if (!is(Group1.expand[index] == Group2.expand[index]))
return false;
}
return true;
}
unittest
{
alias a = Group!(int, double), b = Group!(double, int);
static assert (!compare!(a, b));
}
CODE
dmd -c -w -unittest bug
----
DMD v2.069-devel-6279af3 DEBUG
bug.d(13): Warning: statement is not reachable
----
This is similar to issue 14835, but now the warning is also emitted with static
foreach loops.
--
More information about the Digitalmars-d-bugs
mailing list