diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-05-15 19:11:46 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-05-15 19:11:46 +0000 |
| commit | 1ec5e9f025a40354aff126f7cb5d7b4ead4546c5 (patch) | |
| tree | 36575a38cedbe7640dc27a6d38a5404231fee605 /clang/lib | |
| parent | 9d73cabf22b970ec47eaae9b01ca55430f426618 (diff) | |
| download | bcm5719-llvm-1ec5e9f025a40354aff126f7cb5d7b4ead4546c5.tar.gz bcm5719-llvm-1ec5e9f025a40354aff126f7cb5d7b4ead4546c5.zip | |
Make sure that the type associated with a class template is dependent.
llvm-svn: 71878
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index c32aefb830b..361fef0325d 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -35,9 +35,11 @@ CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC, CXXRecordDecl *CXXRecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - CXXRecordDecl* PrevDecl) { + CXXRecordDecl* PrevDecl, + bool DelayTypeCreation) { CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id); - C.getTypeDeclType(R, PrevDecl); + if (!DelayTypeCreation) + C.getTypeDeclType(R, PrevDecl); return R; } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 09e32f7b65c..afd801cf619 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -509,7 +509,8 @@ Sema::ActOnClassTemplate(Scope *S, unsigned TagSpec, TagKind TK, CXXRecordDecl *NewClass = CXXRecordDecl::Create(Context, Kind, SemanticContext, NameLoc, Name, PrevClassTemplate? - PrevClassTemplate->getTemplatedDecl() : 0); + PrevClassTemplate->getTemplatedDecl() : 0, + /*DelayTypeCreation=*/true); ClassTemplateDecl *NewTemplate = ClassTemplateDecl::Create(Context, SemanticContext, NameLoc, @@ -517,6 +518,14 @@ Sema::ActOnClassTemplate(Scope *S, unsigned TagSpec, TagKind TK, NewClass, PrevClassTemplate); NewClass->setDescribedClassTemplate(NewTemplate); + // Build the type for the class template declaration now. + QualType T = + Context.getTypeDeclType(NewClass, + PrevClassTemplate? + PrevClassTemplate->getTemplatedDecl() : 0); + assert(T->isDependentType() && "Class template type is not dependent?"); + (void)T; + // Set the access specifier. SetMemberAccessSpecifier(NewTemplate, PrevClassTemplate, AS); |

