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 | 9edad9b6184c730a73dc9241c043ea3bae54189f (patch) | |
tree | 7f3c3d4cb242b5c013304eed6a02edb86bef36fd /lib/Sema/SemaTemplate.cpp | |
parent | 608300be1972c43fe99154d25d62d697e7c0a0c2 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index e75277e823..d2e70cf9ad 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/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; |