QualType InjectedType;
friend class ASTContext; // ASTContext creates these.
+ friend class TagDecl; // TagDecl mutilates the Decl
InjectedClassNameType(CXXRecordDecl *D, QualType TST)
: Type(InjectedClassName, QualType(), true),
Decl(D), InjectedType(TST) {
if (TagType *TagT = const_cast<TagType *>(TypeForDecl->getAs<TagType>())) {
TagT->decl.setPointer(this);
TagT->decl.setInt(1);
+ } else if (InjectedClassNameType *Injected
+ = const_cast<InjectedClassNameType *>(
+ TypeForDecl->getAs<InjectedClassNameType>())) {
+ Injected->Decl = cast<CXXRecordDecl>(this);
}
if (isa<CXXRecordDecl>(this)) {
assert(TagT->decl.getPointer() == this &&
"Attempt to redefine a tag definition?");
TagT->decl.setInt(0);
+ } else if (InjectedClassNameType *Injected
+ = const_cast<InjectedClassNameType *>(
+ TypeForDecl->getAs<InjectedClassNameType>())) {
+ assert(Injected->Decl == this &&
+ "Attempt to redefine a class template definition?");
}
}