summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaCXXScopeSpec.cpp7
-rw-r--r--clang/test/CXX/temp/temp.res/temp.local/p3.cpp3
-rw-r--r--clang/test/Modules/no-linkage.cpp2
3 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp
index 9e146ed3a64..68a1d7368e2 100644
--- a/clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -533,6 +533,9 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S,
LookupName(Found, S);
}
+ if (Found.isAmbiguous())
+ return true;
+
// If we performed lookup into a dependent context and did not find anything,
// that's fine: just build a dependent nested-name-specifier.
if (Found.empty() && isDependent &&
@@ -551,8 +554,6 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S,
return false;
}
- // FIXME: Deal with ambiguities cleanly.
-
if (Found.empty() && !ErrorRecoveryLookup) {
// If identifier is not found as class-name-or-namespace-name, but is found
// as other entity, don't look for typos.
@@ -562,6 +563,8 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S,
else if (S && !isDependent)
LookupName(R, S);
if (!R.empty()) {
+ // Don't diagnose problems with this speculative lookup.
+ R.suppressDiagnostics();
// The identifier is found in ordinary lookup. If correction to colon is
// allowed, suggest replacement to ':'.
if (IsCorrectedToColon) {
diff --git a/clang/test/CXX/temp/temp.res/temp.local/p3.cpp b/clang/test/CXX/temp/temp.res/temp.local/p3.cpp
index d5e37866059..63c40fb5769 100644
--- a/clang/test/CXX/temp/temp.res/temp.local/p3.cpp
+++ b/clang/test/CXX/temp/temp.res/temp.local/p3.cpp
@@ -14,8 +14,7 @@ template <class T> struct Derived: Base<int>, Base<char> {
t->Derived::Base<T>::f();
t->Base<T>::f();
t->Base::f(); // expected-error{{member 'Base' found in multiple base classes of different types}} \
- // expected-error{{no member named 'f' in 'X0'}} \
- // expected-error{{'Base' is not a class, namespace, or enumeration}}
+ // expected-error{{no member named 'f' in 'X0'}}
}
};
diff --git a/clang/test/Modules/no-linkage.cpp b/clang/test/Modules/no-linkage.cpp
index 508464e8dbe..0cc808b6331 100644
--- a/clang/test/Modules/no-linkage.cpp
+++ b/clang/test/Modules/no-linkage.cpp
@@ -28,7 +28,7 @@ void use_things() {
void use_things_again() {
use(Typedef().n); // expected-error {{ambiguous}}
- use(NS::n); // expected-error {{ambiguous}} expected-error{{'NS' is not a class, namespace, or enumeration}}
+ use(NS::n); // expected-error {{ambiguous}}
use(AliasDecl); // expected-error {{ambiguous}}
use(Enumerator); // expected-error {{ambiguous}}
use(UsingDecl); // expected-error {{ambiguous}}
OpenPOWER on IntegriCloud