diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-07-28 14:49:07 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-07-28 14:49:07 +0000 |
| commit | df65c8ed2a2ff426a30f0dbac3ef3ea48a651627 (patch) | |
| tree | 44f5cdb565910453ba577dc61905258362f0443b /clang | |
| parent | 0a970698dac9dd9cde5d5b28c6c3082f4d7f1c33 (diff) | |
| download | bcm5719-llvm-df65c8ed2a2ff426a30f0dbac3ef3ea48a651627.tar.gz bcm5719-llvm-df65c8ed2a2ff426a30f0dbac3ef3ea48a651627.zip | |
When a nested-name-specifier refers into a current instantiation that has
dependent bases, construct a dependent nested-name-specifier rather
than complaining that the name could not be found within the current
instantiation itself. Fixes PR7725.
llvm-svn: 109582
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaCXXScopeSpec.cpp | 19 | ||||
| -rw-r--r-- | clang/test/SemaTemplate/nested-name-spec-template.cpp | 11 |
2 files changed, 24 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index f56573a8de2..f2048fe31c3 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -416,7 +416,17 @@ Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S, ObjectTypeSearchedInScope = true; } - } else if (isDependent) { + } else if (!isDependent) { + // Perform unqualified name lookup in the current scope. + LookupName(Found, S); + } + + // 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 && + !(LookupCtx && LookupCtx->isRecord() && + (!cast<CXXRecordDecl>(LookupCtx)->hasDefinition() || + !cast<CXXRecordDecl>(LookupCtx)->hasAnyDependentBases()))) { // Don't speculate if we're just trying to improve error recovery. if (ErrorRecoveryLookup) return 0; @@ -429,11 +439,8 @@ Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S, return NestedNameSpecifier::Create(Context, &II); return NestedNameSpecifier::Create(Context, Prefix, &II); - } else { - // Perform unqualified name lookup in the current scope. - LookupName(Found, S); - } - + } + // FIXME: Deal with ambiguities cleanly. if (Found.empty() && !ErrorRecoveryLookup) { diff --git a/clang/test/SemaTemplate/nested-name-spec-template.cpp b/clang/test/SemaTemplate/nested-name-spec-template.cpp index 12ab4868091..9c72845fb6a 100644 --- a/clang/test/SemaTemplate/nested-name-spec-template.cpp +++ b/clang/test/SemaTemplate/nested-name-spec-template.cpp @@ -88,3 +88,14 @@ namespace PR7385 { has_xxx0<int>::type t; // expected-note{{instantiation of}} } + +namespace PR7725 { + template<class ignored> struct TypedefProvider; + template<typename T> + struct TemplateClass : public TypedefProvider<T> + { + void PrintSelf() { + TemplateClass::Test::PrintSelf(); + } + }; +} |

