On Tuesday, 27 October 2015 at 13:23:51 UTC, Timon Gehr wrote:
On 10/27/2015 01:35 PM, Steven Schveighoffer wrote:
Easy to fix:
void reachIf(bool x)()
{
static if(!x)
return;
else
writeln("reached");
}
The warning is correct, and incredibly annoying.
Easy to fix, but the warning is incorrect, the statement is
reachable if
you use reachIf!true.
A statement is not a compiled piece of code.
-Steve
Versions of the same statement in different instantiations are
independent. Templates are just a restricted form of hygienic
macros.
That's how the current implementation works, but that doesn't
mean the warning is actually *helpful*.