summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-19 16:01:07 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-19 16:01:07 +0000
commit9abe2377e718fed1201e48b27bfa98b223673094 (patch)
tree375bd49bb957031117641a9f8f9ba203c8b76613 /clang/lib/Sema/SemaTemplate.cpp
parentc9818a77cbb4de4c5a64c8a5835a0101b25aa485 (diff)
downloadbcm5719-llvm-9abe2377e718fed1201e48b27bfa98b223673094.tar.gz
bcm5719-llvm-9abe2377e718fed1201e48b27bfa98b223673094.zip
Teach Sema::ActOnDependentTemplateName that a dependent template name
in a member access expression referring into the current instantiation need not be resolved at template definition *if* the current instantiation has any dependent base classes. Fixes PR6081. llvm-svn: 93877
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 2fad8325d4d..0773a0f1e4d 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -1586,9 +1586,12 @@ Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
UnqualifiedId &Name,
TypeTy *ObjectType,
bool EnteringContext) {
- if ((ObjectType &&
- computeDeclContext(QualType::getFromOpaquePtr(ObjectType))) ||
- (SS.isSet() && computeDeclContext(SS, EnteringContext))) {
+ DeclContext *LookupCtx = 0;
+ if (SS.isSet())
+ LookupCtx = computeDeclContext(SS, EnteringContext);
+ if (!LookupCtx && ObjectType)
+ LookupCtx = computeDeclContext(QualType::getFromOpaquePtr(ObjectType));
+ if (LookupCtx) {
// C++0x [temp.names]p5:
// If a name prefixed by the keyword template is not the name of
// a template, the program is ill-formed. [Note: the keyword
@@ -1608,8 +1611,9 @@ Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
TemplateTy Template;
TemplateNameKind TNK = isTemplateName(0, SS, Name, ObjectType,
EnteringContext, Template);
- if (TNK == TNK_Non_template &&
- isCurrentInstantiationWithDependentBases(SS)) {
+ if (TNK == TNK_Non_template && LookupCtx->isDependentContext() &&
+ isa<CXXRecordDecl>(LookupCtx) &&
+ cast<CXXRecordDecl>(LookupCtx)->hasAnyDependentBases()) {
// This is a dependent template.
} else if (TNK == TNK_Non_template) {
Diag(Name.getSourceRange().getBegin(),
OpenPOWER on IntegriCloud