summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-10 19:44:59 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-10 19:44:59 +0000
commit869853eea1a876b44b369b3b439d7b42de8692ec (patch)
tree425acc3336746bcf4a0222878b1bc5eddc2a39f5 /clang/lib/Sema/SemaTemplateInstantiate.cpp
parentcf7e9a04856fbcf7e7f21e91f29c7a074bdd58df (diff)
downloadbcm5719-llvm-869853eea1a876b44b369b3b439d7b42de8692ec.tar.gz
bcm5719-llvm-869853eea1a876b44b369b3b439d7b42de8692ec.zip
Instantiate class member template partial specialization declarations
in the order they occur within the class template, delaying out-of-line member template partial specializations until after the class has been fully instantiated. This fixes a regression introduced by r118454 (itself a fix for PR8001). llvm-svn: 118704
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index af9af0ab83a..3468a3d93f6 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1221,6 +1221,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
if (SubstBaseSpecifiers(Instantiation, Pattern, TemplateArgs))
Invalid = true;
+ TemplateDeclInstantiator Instantiator(*this, Instantiation, TemplateArgs);
llvm::SmallVector<Decl*, 4> Fields;
for (RecordDecl::decl_iterator Member = Pattern->decls_begin(),
MemberEnd = Pattern->decls_end();
@@ -1237,7 +1238,12 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
if ((*Member)->getDeclContext() != Pattern)
continue;
- Decl *NewMember = SubstDecl(*Member, Instantiation, TemplateArgs);
+ if ((*Member)->isInvalidDecl()) {
+ Invalid = true;
+ continue;
+ }
+
+ Decl *NewMember = Instantiator.Visit(*Member);
if (NewMember) {
if (FieldDecl *Field = dyn_cast<FieldDecl>(NewMember))
Fields.push_back(Field);
@@ -1257,7 +1263,22 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
CheckCompletedCXXClass(Instantiation);
if (Instantiation->isInvalidDecl())
Invalid = true;
-
+ else {
+ // Instantiate any out-of-line class template partial
+ // specializations now.
+ for (TemplateDeclInstantiator::delayed_partial_spec_iterator
+ P = Instantiator.delayed_partial_spec_begin(),
+ PEnd = Instantiator.delayed_partial_spec_end();
+ P != PEnd; ++P) {
+ if (!Instantiator.InstantiateClassTemplatePartialSpecialization(
+ P->first,
+ P->second)) {
+ Invalid = true;
+ break;
+ }
+ }
+ }
+
// Exit the scope of this instantiation.
SavedContext.pop();
OpenPOWER on IntegriCloud