Fixing spurious "statement is not reachable" in template code
Daniel Murphy via Digitalmars-d
digitalmars-d at puremagic.com
Wed Oct 28 03:03:46 PDT 2015
On 28/10/2015 4:02 PM, tsbockman wrote:
> (But not all control flow statements have static equivalents, so this
> solution can only be applied to some code. Even if we had `static
> switch`, `static foreach`, `static goto`, etc., I doubt that forcing the
> user to segregate all compile-time logic from the run-time logic in that
> way is desirable.)
Nobody is forcing anyone to do this. Warnings are opt-in.
> Whether the logic is explicitly `static` (compile time) or not, the
> warning should be issued if and only if the flagged code is unreachable
> with all possible input combinations - including both compile-time and
> run-time.
In D's compilation model it is not possible to know all possible
instantiations at compilation time.
More information about the Digitalmars-d
mailing list