diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 984247bacc6e..4545bf9d855f 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -4990,6 +4990,8 @@ bool FunctionCallFilterCCC::ValidateCandidate(const TypoCorrection &candidate) { // determine if it is a pointer or reference to a function. If so, // check against the number of arguments expected for the pointee. QualType ValType = cast(ND)->getType(); + if (ValType.isNull()) + continue; if (ValType->isAnyPointerType() || ValType->isReferenceType()) ValType = ValType->getPointeeType(); if (const FunctionProtoType *FPT = ValType->getAs()) diff --git a/clang/test/SemaCXX/typo-correction-cxx17.cpp b/clang/test/SemaCXX/typo-correction-cxx17.cpp new file mode 100644 index 000000000000..f13749975342 --- /dev/null +++ b/clang/test/SemaCXX/typo-correction-cxx17.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify %s + +namespace decomp_decl { +void f() { + auto [this_is_a_typo] = this_is_a_typp(); // expected-error{{use of undeclared identifier 'this_is_a_typp'}} +} +}