summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCXXScopeSpec.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-11-22 00:24:47 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-11-22 00:24:47 +0000
commitd80b2d57cf24fb80c8ecc40b32ca10fdbeae0c85 (patch)
tree57f99c982707c8bbd59ffb8ec9634ea998f22abe /clang/lib/Sema/SemaCXXScopeSpec.cpp
parent56cb16dd927fa9304aa5b4474aa1d23ea8acc5c0 (diff)
downloadbcm5719-llvm-d80b2d57cf24fb80c8ecc40b32ca10fdbeae0c85.tar.gz
bcm5719-llvm-d80b2d57cf24fb80c8ecc40b32ca10fdbeae0c85.zip
Fix CXXRecordDecl::forallBases to not look through bases which are dependent
and defined within the current instantiation, but which are not part of the current instantiation. Previously, it would look at bases which could be specialized separately from the current template. llvm-svn: 168477
Diffstat (limited to 'clang/lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r--clang/lib/Sema/SemaCXXScopeSpec.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp
index 15bfd1ce629..7db604d9cc1 100644
--- a/clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -26,7 +26,7 @@
using namespace clang;
/// \brief Find the current instantiation that associated with the given type.
-static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
+static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
DeclContext *CurContext) {
if (T.isNull())
return 0;
@@ -34,16 +34,10 @@ static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
const Type *Ty = T->getCanonicalTypeInternal().getTypePtr();
if (const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordTy->getDecl());
- if (!T->isDependentType())
+ if (!Record->isDependentContext() ||
+ Record->isCurrentInstantiation(CurContext))
return Record;
- // This may be a member of a class template or class template partial
- // specialization. If it's part of the current semantic context, then it's
- // an injected-class-name;
- for (; !CurContext->isFileContext(); CurContext = CurContext->getParent())
- if (CurContext->Equals(Record))
- return Record;
-
return 0;
} else if (isa<InjectedClassNameType>(Ty))
return cast<InjectedClassNameType>(Ty)->getDecl();
OpenPOWER on IntegriCloud