diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-22 06:58:37 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-22 06:58:37 +0000 |
commit | 745af1c348191bf31cfcd3ae61443a0321ec2d75 (patch) | |
tree | fc5e3c5b2e02f9281924d3c98693a241d61450b4 /lib/Sema/SemaLookup.cpp | |
parent | d5668a2447c2afeea38815b51a80a5a6ac235599 (diff) |
In LookupResult::resolveKind(), when handling multiple found declarations, ignore invalid declarations.
This reduces the "ambiguous reference" errors (which are rather strange in C/ObjC) and fixes an assertion hit
with an invalid code test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index a4228a5058..d931bc7dd9 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -371,6 +371,12 @@ void LookupResult::resolveKind() { NamedDecl *D = Decls[I]->getUnderlyingDecl(); D = cast<NamedDecl>(D->getCanonicalDecl()); + // Ignore an invalid declaration unless it's the only one left. + if (D->isInvalidDecl() && I < N-1) { + Decls[I] = Decls[--N]; + continue; + } + // Redeclarations of types via typedef can occur both within a scope // and, through using declarations and directives, across scopes. There is // no ambiguity if they all refer to the same type, so unique based on the |