diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-14 17:47:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-14 17:47:39 +0000 |
commit | d2e6a457229ccf2478cbd7de5fe763b871a482d8 (patch) | |
tree | ecb0845d6180610cd78c298314fb8a99b0b09741 /clang/lib/Sema/SemaTemplate.cpp | |
parent | fc59ce1ea47cd9ea8f887dc5e5ae8191ef762957 (diff) | |
download | bcm5719-llvm-d2e6a457229ccf2478cbd7de5fe763b871a482d8.tar.gz bcm5719-llvm-d2e6a457229ccf2478cbd7de5fe763b871a482d8.zip |
When qualified lookup into the current instantiation fails (because it
finds nothing), and the current instantiation has dependent base
classes, treat the qualified lookup as if it referred to an unknown
specialization. Fixes PR6031.
llvm-svn: 93433
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index e75277e823e..d2e70cf9ad6 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1608,15 +1608,19 @@ Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc, TemplateTy Template; TemplateNameKind TNK = isTemplateName(0, SS, Name, ObjectType, EnteringContext, Template); - if (TNK == TNK_Non_template) { + if (TNK == TNK_Non_template && + isCurrentInstantiationWithDependentBases(SS)) { + // This is a dependent template. + } else if (TNK == TNK_Non_template) { Diag(Name.getSourceRange().getBegin(), diag::err_template_kw_refers_to_non_template) << GetNameFromUnqualifiedId(Name) << Name.getSourceRange(); return TemplateTy(); + } else { + // We found something; return it. + return Template; } - - return Template; } NestedNameSpecifier *Qualifier @@ -4765,6 +4769,14 @@ Sema::CheckTypenameType(NestedNameSpecifier *NNS, const IdentifierInfo &II, 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; |