[Issue 14835] Statement is not reachable doesn't play along generic code
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Oct 24 01:31:32 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14835
--- Comment #6 from thomas.bockman at gmail.com ---
Here's a minimal compilable (requires dmd argument -wi, rather than -w)
example, for anyone trying to fix this:
module main;
import std.stdio;
void reachIf(bool x)()
{
if(!x)
return;
writeln("reached"); // Warning: statement is not reachable
}
void main(string[] args) {
reachIf!true(); // prints "reached"
reachIf!false(); // triggers warning
}
--
More information about the Digitalmars-d-bugs
mailing list