diff --git a/src/expression.c b/src/expression.c index b8b4f2437049..f27e63266f14 100644 --- a/src/expression.c +++ b/src/expression.c @@ -8334,6 +8334,8 @@ Expression *CallExp::semantic(Scope *sc) } f = resolveFuncCall(sc, loc, cd->ctor, NULL, NULL, arguments, 0); + if (!f) + return new ErrorExp(); checkDeprecated(sc, f); #if DMDV2 checkPurity(sc, f); diff --git a/test/fail_compilation/ice9284.d b/test/fail_compilation/ice9284.d new file mode 100644 index 000000000000..b9e44da727de --- /dev/null +++ b/test/fail_compilation/ice9284.d @@ -0,0 +1,22 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice9284.d(15): Error: template ice9284.C.__ctor does not match any function template declaration. Candidates are: +fail_compilation/ice9284.d(13): ice9284.C.__ctor()(string) +fail_compilation/ice9284.d(15): Error: template ice9284.C.__ctor()(string) cannot deduce template function from argument types !()(int) +fail_compilation/ice9284.d(21): Error: template instance ice9284.C.__ctor!() error instantiating +--- +*/ + +class C +{ + this()(string) + { + this(10); + // delegating to a constructor which not exists. + } +} +void main() +{ + new C("hello"); +}