From fda9daeb032b12d97cd96ca9863ebbd036c0d159 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Sat, 13 Jan 2018 15:24:16 +0000 Subject: [Sema] Fix crash for type-dependent base classes llvm-svn: 322438 --- clang/lib/Sema/SemaDeclCXX.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/Sema/SemaDeclCXX.cpp') diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index f0a176b14cf..6873feb7802 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2417,9 +2417,16 @@ bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class, // Attach the remaining base class specifiers to the derived class. Class->setBases(Bases.data(), NumGoodBases); + // Check that the only base classes that are duplicate are virtual. for (unsigned idx = 0; idx < NumGoodBases; ++idx) { // Check whether this direct base is inaccessible due to ambiguity. QualType BaseType = Bases[idx]->getType(); + + // Skip all dependent types in templates being used as base specifiers. + // Checks below assume that the base specifier is a CXXRecord. + if (BaseType->isDependentType()) + continue; + CanQualType CanonicalBase = Context.getCanonicalType(BaseType) .getUnqualifiedType(); -- cgit v1.2.3