When performing qualified name lookup into the current instantiation,
do not look into base classes if there are any dependent base
classes. Instead, note in the lookup result that we couldn't look into
any dependent bases. Use that new result kind to detect when this case
occurs, so that we can fall back to treating the type/value/etc. as a
member of an unknown specialization.
Fixes an issue where we were resolving lookup at template definition
time and then missing an ambiguity at template instantiation time.
llvm-svn: 93497
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index d2e70cf..2fad832 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4769,16 +4769,12 @@
Decl *Referenced = 0;
switch (Result.getResultKind()) {
case LookupResult::NotFound:
- if (CurrentInstantiation && CurrentInstantiation->hasAnyDependentBases()) {
- // We performed a lookup in the current instantiation and didn't
- // find anything. However, this current instantiation has
- // dependent bases, so we might be able to find something at
- // instantiation time: just build a TypenameType and move on.
- return Context.getTypenameType(NNS, &II);
- }
-
DiagID = diag::err_typename_nested_not_found;
break;
+
+ case LookupResult::NotFoundInCurrentInstantiation:
+ // Okay, it's a member of an unknown instantiation.
+ return Context.getTypenameType(NNS, &II);
case LookupResult::Found:
if (TypeDecl *Type = dyn_cast<TypeDecl>(Result.getFoundDecl())) {