[PATCH] D41897: Fixing a crash in Sema.
Jan Korous via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 11 03:09:35 PST 2018
jkorous-apple updated this revision to Diff 129284.
jkorous-apple added a comment.
Changes based on Aaron's feedback.
https://reviews.llvm.org/D41897
Files:
Sema/SemaDeclCXX.cpp
SemaCXX/base-class-ambiguity-check.cpp
Index: SemaCXX/base-class-ambiguity-check.cpp
===================================================================
--- /dev/null
+++ SemaCXX/base-class-ambiguity-check.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+template <typename T> class Foo {
+ struct Base : T {};
+
+ // Up to commit 680b3a8619 (2018-01-10) this produced a crash in Sema.
+ struct Derived : Base, T {};
+};
Index: Sema/SemaDeclCXX.cpp
===================================================================
--- Sema/SemaDeclCXX.cpp
+++ Sema/SemaDeclCXX.cpp
@@ -2417,9 +2417,16 @@
// 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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41897.129284.patch
Type: text/x-patch
Size: 1237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180111/a6b32ee8/attachment.bin>
More information about the cfe-commits
mailing list