diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -6068,8 +6068,6 @@ ExprResult result = S.CheckPlaceholderExpr(args[i]); if (result.isInvalid()) hasInvalid = true; else args[i] = result.get(); - } else if (hasInvalid) { - (void)S.CorrectDelayedTyposInExpr(args[i]); } } return hasInvalid; diff --git a/clang/test/SemaCXX/typo-correction-crash.cpp b/clang/test/SemaCXX/typo-correction-crash.cpp --- a/clang/test/SemaCXX/typo-correction-crash.cpp +++ b/clang/test/SemaCXX/typo-correction-crash.cpp @@ -32,3 +32,12 @@ void cast_expr(int g) { +int(n)(g); } // expected-error {{undeclared identifier 'n'}} void bind() { for (const auto& [test,_] : _test_) { }; } // expected-error {{undeclared identifier '_test_'}} + +namespace NoCrash { +class S { + void Function(int a) { + unknown1(unknown2, Function, unknown3); // expected-error 2{{use of undeclared identifier}} \ + expected-error {{reference to non-static member function must be called}} + } +}; +}