diff --git a/src/expression.c b/src/expression.c index fd78ee61c813..f8008f5fac5a 100644 --- a/src/expression.c +++ b/src/expression.c @@ -8775,7 +8775,7 @@ Expression *CallExp::semantic(Scope *sc) // Do overload resolution f = resolveFuncCall(loc, sc, s, tiargs, ue1 ? ue1->type : NULL, arguments); - if (!f) + if (!f || f->type->ty == Terror) return new ErrorExp(); if (f->needThis()) diff --git a/test/fail_compilation/ice11922.d b/test/fail_compilation/ice11922.d new file mode 100644 index 000000000000..6302f3fe997b --- /dev/null +++ b/test/fail_compilation/ice11922.d @@ -0,0 +1,18 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice11922.d(11): Error: undefined identifier a +fail_compilation/ice11922.d(17): Error: template instance ice11922.S.f!int error instantiating +--- +*/ + +struct S +{ + auto f(B)(B) { return a; } +} + +void main() +{ + S s; + s.f(5); +}