aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-17 05:17:33 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-17 05:17:33 +0000
commit03c5705a99a96a471b2868898ee9688a6721e02a (patch)
tree2d8c60e17f7c37c80d3e44db50196188a2a148ff /lib/Sema/SemaTemplate.cpp
parent145e2ea10fb6240265c3fac8137a5f2b01b1a426 (diff)
Require the object type of a member access expression ("." or "->") to
be complete. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 317d133954..a799ddb24b 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -130,12 +130,17 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
QualType ObjectType = QualType::getFromOpaquePtr(ObjectTypePtr);
LookupCtx = computeDeclContext(ObjectType);
isDependent = ObjectType->isDependentType();
+ assert((isDependent || !ObjectType->isIncompleteType()) &&
+ "Caller should have completed object type");
} else if (SS.isSet()) {
// This nested-name-specifier occurs after another nested-name-specifier,
// so long into the context associated with the prior nested-name-specifier.
-
LookupCtx = computeDeclContext(SS, EnteringContext);
isDependent = isDependentScopeSpecifier(SS);
+
+ // The declaration context must be complete.
+ if (LookupCtx && RequireCompleteDeclContext(SS))
+ return TNK_Non_template;
}
LookupResult Found(*this, TName, SourceLocation(), LookupOrdinaryName);
@@ -145,11 +150,6 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
// computed, which is either the type of the base of a member access
// expression or the declaration context associated with a prior
// nested-name-specifier.
-
- // The declaration context must be complete.
- if (!LookupCtx->isDependentContext() && RequireCompleteDeclContext(SS))
- return TNK_Non_template;
-
LookupQualifiedName(Found, LookupCtx);
if (ObjectTypePtr && Found.empty()) {