https://issues.dlang.org/show_bug.cgi?id=15002
--- Comment #4 from Iain Buclaw <ibuc...@gdcproject.org> --- (In reply to Vladimir Panteleev from comment #3) > (In reply to Iain Buclaw from comment #2) > > Regression? Regression from what? Wrong-code to ICE? Valid to ICE? ICE > > to another ICE? > > From expected error message, to expected error message + ICE: > It looks like CTFE still tries to have a go at interpreting the invalid code. All that change does is enforce that the front-end never passes to CTFE an invalid state, so don't shoot the messenger! Something like the following stops the invalid code from reaching CTFE: diff --git a/src/init.d b/src/init.d index dd9db91..1e53e22 100644 --- a/src/init.d +++ b/src/init.d @@ -822,15 +822,15 @@ public: Initializer semantic(Scope* sc, Type t, NeedInterpret needInterpret) { //printf("ExpInitializer::semantic(%s), type = %s\n", exp->toChars(), t->toChars()); + uint olderrors = global.errors; if (needInterpret) sc = sc.startCTFE(); exp = exp.semantic(sc); exp = resolveProperties(sc, exp); if (needInterpret) sc = sc.endCTFE(); - if (exp.op == TOKerror) + if (exp.op == TOKerror || olderrors != global.errors) return new ErrorInitializer(); - uint olderrors = global.errors; if (needInterpret) { // If the result will be implicitly cast, move the cast into CTFE Though the semantic passes should *really* do more in propagating ErrorExp up rather than relying on checking 'global.errors' for checking for problems during compilation. --