forked from OSchip/llvm-project
[Sema] Fix a structured binding typo correction bug
BindingDecls have null type until their initializer is processed, so we can't assume that a correction candidate has non-null type. rdar://41559582 llvm-svn: 336634
This commit is contained in:
parent
25291f15e7
commit
1c5ae9bc1f
|
@ -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<ValueDecl>(ND)->getType();
|
||||
if (ValType.isNull())
|
||||
continue;
|
||||
if (ValType->isAnyPointerType() || ValType->isReferenceType())
|
||||
ValType = ValType->getPointeeType();
|
||||
if (const FunctionProtoType *FPT = ValType->getAs<FunctionProtoType>())
|
||||
|
|
|
@ -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'}}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue