Make sure that the type associated with a class template is dependent.

llvm-svn: 71878
This commit is contained in:
Douglas Gregor 2009-05-15 19:11:46 +00:00
parent 9d73cabf22
commit 1ec5e9f025
3 changed files with 16 additions and 4 deletions

View File

@ -264,7 +264,8 @@ public:
static CXXRecordDecl *Create(ASTContext &C, TagKind TK, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
CXXRecordDecl* PrevDecl=0);
CXXRecordDecl* PrevDecl=0,
bool DelayTypeCreation = false);
/// setBases - Sets the base classes of this struct or class.
void setBases(CXXBaseSpecifier const * const *Bases, unsigned NumBases);

View File

@ -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;
}

View File

@ -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);