aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCXXScopeSpec.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-28 14:49:07 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-28 14:49:07 +0000
commitac7cbd8102a944c7e988b066fc52c03fdd536dc0 (patch)
treec91f91bd0d7bf1f55ef78df7644634057395e8e8 /lib/Sema/SemaCXXScopeSpec.cpp
parent8670cd3ea4dfbf86caacd270ec2441e9949bbb6a (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109582 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index f56573a8de..f2048fe31c 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/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) {