https://issues.dlang.org/show_bug.cgi?id=18115
--- Comment #8 from Basile B. <b2.t...@gmx.com> --- (In reply to Rainer Schuetze from comment #7) > > 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. Sorry, did you miss my previous answer ? Use the code from the first message. The regression is obvious. --