[cfe-commits] r97291 - in /cfe/trunk: lib/AST/DeclCXX.cpp lib/Sema/SemaDeclCXX.cpp test/SemaTemplate/dependent-base-classes.cpp
Douglas Gregor
dgregor at apple.com
Fri Feb 26 16:25:29 PST 2010
Author: dgregor
Date: Fri Feb 26 18:25:28 2010
New Revision: 97291
URL: http://llvm.org/viewvc/llvm-project?rev=97291&view=rev
Log:
Skip dependent virtual base classes; fixes PR6413.
Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=97291&r1=97290&r2=97291&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri Feb 26 18:25:28 2010
@@ -94,9 +94,7 @@
// Keep track of inherited vbases for this base class.
const CXXBaseSpecifier *Base = Bases[i];
QualType BaseType = Base->getType();
- // Skip template types.
- // FIXME. This means that this list must be rebuilt during template
- // instantiation.
+ // Skip dependent types; we can't do any checking on them now.
if (BaseType->isDependentType())
continue;
CXXRecordDecl *BaseClassDecl
@@ -143,6 +141,9 @@
data().NumVBases = vbaseCount;
for (int i = 0; i < vbaseCount; i++) {
QualType QT = UniqueVbases[i]->getType();
+ // Skip dependent types; we can't do any checking on them now.
+ if (QT->isDependentType())
+ continue;
CXXRecordDecl *VBaseClassDecl
= cast<CXXRecordDecl>(QT->getAs<RecordType>()->getDecl());
data().VBases[i] =
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=97291&r1=97290&r2=97291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Feb 26 18:25:28 2010
@@ -586,7 +586,10 @@
return true;
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);
if (CXXBaseSpecifier *BaseSpec = CheckBaseSpecifier(Class, SpecifierRange,
Virtual, Access,
Modified: cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp?rev=97291&r1=97290&r2=97291&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp (original)
+++ cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp Fri Feb 26 18:25:28 2010
@@ -109,3 +109,15 @@
}
};
}
+
+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
+ { };
+}
More information about the cfe-commits
mailing list