From c7ec585d78b25e45813c02f3371714dd72401c63 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 17 Mar 2017 14:42:09 -0400 Subject: [PATCH] PR c++/80073 - C++17 ICE with virtual base. * decl.c (xref_basetypes): Also check for indirect vbases. From-SVN: r246242 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 3 +++ gcc/testsuite/g++.dg/init/vbase2.C | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/init/vbase2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 089d388dd4d..a5c150a71f3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-03-17 Jason Merrill + + PR c++/80073 - C++17 ICE with virtual base. + * decl.c (xref_basetypes): Also check for indirect vbases. + 2017-03-16 Jason Merrill * decl.c (start_enum): std::byte aliases anything. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 61ecf81b27a..bf24e8ba164 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13812,6 +13812,9 @@ xref_basetypes (tree ref, tree base_list) if (max_vbases) { + /* An aggregate can't have virtual base classes. */ + CLASSTYPE_NON_AGGREGATE (ref) = true; + vec_alloc (CLASSTYPE_VBASECLASSES (ref), max_vbases); if (max_dvbases) diff --git a/gcc/testsuite/g++.dg/init/vbase2.C b/gcc/testsuite/g++.dg/init/vbase2.C new file mode 100644 index 00000000000..1711ea9e1df --- /dev/null +++ b/gcc/testsuite/g++.dg/init/vbase2.C @@ -0,0 +1,8 @@ +// PR c++/80073 +// { dg-do compile { target c++11 } } + +struct A {}; + +struct B : virtual A {}; + +struct C : B {} c {}; -- 2.30.2