Skip dependent virtual base classes; fixes PR6413.

llvm-svn: 97291
This commit is contained in:
Douglas Gregor 2010-02-27 00:25:28 +00:00
parent 67c0aece75
commit beab56e923
3 changed files with 20 additions and 4 deletions

View File

@ -94,9 +94,7 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
// Keep track of inherited vbases for this base class. // Keep track of inherited vbases for this base class.
const CXXBaseSpecifier *Base = Bases[i]; const CXXBaseSpecifier *Base = Bases[i];
QualType BaseType = Base->getType(); QualType BaseType = Base->getType();
// Skip template types. // Skip dependent types; we can't do any checking on them now.
// FIXME. This means that this list must be rebuilt during template
// instantiation.
if (BaseType->isDependentType()) if (BaseType->isDependentType())
continue; continue;
CXXRecordDecl *BaseClassDecl CXXRecordDecl *BaseClassDecl
@ -143,6 +141,9 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
data().NumVBases = vbaseCount; data().NumVBases = vbaseCount;
for (int i = 0; i < vbaseCount; i++) { for (int i = 0; i < vbaseCount; i++) {
QualType QT = UniqueVbases[i]->getType(); QualType QT = UniqueVbases[i]->getType();
// Skip dependent types; we can't do any checking on them now.
if (QT->isDependentType())
continue;
CXXRecordDecl *VBaseClassDecl CXXRecordDecl *VBaseClassDecl
= cast<CXXRecordDecl>(QT->getAs<RecordType>()->getDecl()); = cast<CXXRecordDecl>(QT->getAs<RecordType>()->getDecl());
data().VBases[i] = data().VBases[i] =

View File

@ -586,7 +586,10 @@ Sema::ActOnBaseSpecifier(DeclPtrTy classdecl, SourceRange SpecifierRange,
return true; return true;
AdjustDeclIfTemplate(classdecl); AdjustDeclIfTemplate(classdecl);
CXXRecordDecl *Class = cast<CXXRecordDecl>(classdecl.getAs<Decl>()); CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(classdecl.getAs<Decl>());
if (!Class)
return true;
QualType BaseType = GetTypeFromParser(basetype); QualType BaseType = GetTypeFromParser(basetype);
if (CXXBaseSpecifier *BaseSpec = CheckBaseSpecifier(Class, SpecifierRange, if (CXXBaseSpecifier *BaseSpec = CheckBaseSpecifier(Class, SpecifierRange,
Virtual, Access, Virtual, Access,

View File

@ -109,3 +109,15 @@ namespace PR6081 {
} }
}; };
} }
namespace PR6413 {
template <typename T> class Base_A { };
class Base_B { };
template <typename T>
class Derived
: public virtual Base_A<T>
, public virtual Base_B
{ };
}