[Issue 18115] [REG2.078-b1] case where && is not shortcut anymore in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 28 08:32:55 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=18115

--- Comment #7 from Rainer Schuetze <r.sagitario at gmx.de> ---
> Rainer, not sure what you're saying. 
> Is it invalid code in the test case, or a compiler problem?

I'm not 100% sure. At runtime the code will always produce a RangeError, but
the check before it causes it to never be executed. Should it still be a
compile error?

Allowing the condition could make writing generic code simpler, but might also
trigger the "unreachable code" warning later. 

To change it, dmd.constfold must not produce errors (unconditionally), but keep
the expressions that *might* cause an error at runtime or CTFE. Array indexing
and divide by zero are probably affected, too.

--


More information about the Digitalmars-d-bugs mailing list