forked from OSchip/llvm-project
[Sema] Fix crash for type-dependent base classes
llvm-svn: 322438
This commit is contained in:
parent
0a80f8924b
commit
fda9daeb03
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
template <typename T> class Foo {
|
||||
struct Base : T {};
|
||||
|
||||
// Test that this code no longer causes a crash in Sema. rdar://23291875
|
||||
struct Derived : Base, T {};
|
||||
};
|
||||
Loading…
Reference in New Issue