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);
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;
}
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,
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);