[Issue 16201] When all paths inside a static if return/throw, the portion after static if should be as if "else" were used
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 24 11:00:56 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16201
--- Comment #4 from Andrei Alexandrescu <andrei at erdani.com> ---
Sorry for being unclear. It's a superset, not a dupe of 14835. Consider:
void fun(T)(T obj)
{
static if (!hasMember(T, "gun")) throw new Exception("No gun");
obj.gun;
}
This code should just work.
--
More information about the Digitalmars-d-bugs
mailing list