aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaLookup.cpp6
-rw-r--r--test/Sema/invalid-decl.c4
-rw-r--r--test/SemaObjC/crash-on-objc-bool-literal.m9
3 files changed, 14 insertions, 5 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
diff --git a/test/Sema/invalid-decl.c b/test/Sema/invalid-decl.c
index 4e628817d2..950d51deb4 100644
--- a/test/Sema/invalid-decl.c
+++ b/test/Sema/invalid-decl.c
@@ -42,3 +42,7 @@ void foo() {
void test2();
void test2(undef); // expected-error {{a parameter list without types is only allowed in a function definition}}
void test2() { }
+
+void test3();
+void test3; // expected-error {{incomplete type}}
+void test3() { }
diff --git a/test/SemaObjC/crash-on-objc-bool-literal.m b/test/SemaObjC/crash-on-objc-bool-literal.m
index 2c003a534b..47e1ce284b 100644
--- a/test/SemaObjC/crash-on-objc-bool-literal.m
+++ b/test/SemaObjC/crash-on-objc-bool-literal.m
@@ -2,11 +2,10 @@
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
// rdar://12456743
-typedef signed char BOOL; // expected-note 2 {{candidate found by name lookup is 'BOOL'}}
+typedef signed char BOOL;
-EXPORT BOOL FUNC(BOOL enabled); // expected-error {{unknown type name 'EXPORT'}} // expected-error {{expected ';' after top level declarator}} \
- // expected-note 2 {{candidate found by name lookup is 'BOOL'}}
+EXPORT BOOL FUNC(BOOL enabled); // expected-error {{unknown type name 'EXPORT'}} // expected-error {{expected ';' after top level declarator}}
-static inline BOOL MFIsPrivateVersion(void) { // expected-error {{reference to 'BOOL' is ambiguous}}
- return __objc_yes; // expected-error {{reference to 'BOOL' is ambiguous}}
+static inline BOOL MFIsPrivateVersion(void) {
+ return __objc_yes;
}