From: Paolo Carlini Date: Thu, 9 Jun 2016 12:02:17 +0000 (+0000) Subject: re PR c++/71465 (ICE on invalid C++ code (with duplicate base) on x86_64-linux-gnu... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=392a81b96ea19e2d302372a4261b6183e82d1477;p=gcc.git re PR c++/71465 (ICE on invalid C++ code (with duplicate base) on x86_64-linux-gnu: in dfs_build_secondary_vptr_vtt_inits, at cp/class.c:9075) /cp 2016-06-09 Paolo Carlini PR c++/71465 Revert: 2016-06-04 Paolo Carlini PR c++/70202 * parser.c (cp_parser_class_head): When xref_basetypes fails and emits an error do not zero the type. /testsuite 2016-06-09 Paolo Carlini PR c++/71465 * g++.dg/inherit/crash5.C: New. Revert: 2016-06-04 Paolo Carlini PR c++/70202 * g++.dg/inherit/crash5.C: New. * g++.dg/inherit/virtual1.C: Adjust. From-SVN: r237258 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 54c838bfeaa..a94cebea7dc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2016-06-09 Paolo Carlini + + PR c++/71465 + Revert: + 2016-06-04 Paolo Carlini + + PR c++/70202 + * parser.c (cp_parser_class_head): When xref_basetypes fails and + emits an error do not zero the type. + 2016-06-08 Paolo Carlini * decl.c (maybe_deduce_size_from_array_init): Use diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 2fccc5acf01..e01353d5dc1 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22050,8 +22050,9 @@ cp_parser_class_head (cp_parser* parser, /* If we're really defining a class, process the base classes. If they're invalid, fail. */ - if (type && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) - xref_basetypes (type, bases); + if (type && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE) + && !xref_basetypes (type, bases)) + type = NULL_TREE; done: /* Leave the scope given by the nested-name-specifier. We will diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 155dc1144fe..b1ea45ada40 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-06-09 Paolo Carlini + + PR c++/71465 + * g++.dg/inherit/crash5.C: New. + Revert: + 2016-06-04 Paolo Carlini + + PR c++/70202 + * g++.dg/inherit/crash5.C: New. + * g++.dg/inherit/virtual1.C: Adjust. + 2016-06-09 Martin Liska * g++.dg/predict-loop-exit-1.C: Scan for a new dump format. diff --git a/gcc/testsuite/g++.dg/inherit/crash5.C b/gcc/testsuite/g++.dg/inherit/crash5.C index bce999ccbe5..5a4002e0f8a 100644 --- a/gcc/testsuite/g++.dg/inherit/crash5.C +++ b/gcc/testsuite/g++.dg/inherit/crash5.C @@ -1,10 +1,6 @@ -// PR c++/70202 +// PR c++/71465 -class A -{ - virtual void foo () { } -}; -class B : public A, A { }; // { dg-error "duplicate base type" } - -B b1, &b2 = b1; -A a = b2; +struct A { virtual void foo () {} }; +struct B : virtual A {}; +struct C : virtual A {}; +struct D : C, B, C {}; // { dg-error "duplicate base type" } diff --git a/gcc/testsuite/g++.dg/inherit/virtual1.C b/gcc/testsuite/g++.dg/inherit/virtual1.C index 1199b815f56..08bcbb143cf 100644 --- a/gcc/testsuite/g++.dg/inherit/virtual1.C +++ b/gcc/testsuite/g++.dg/inherit/virtual1.C @@ -5,8 +5,8 @@ struct A virtual ~A() {} }; -struct B : A, virtual A {}; // { dg-error "duplicate base" } +struct B : A, virtual A {}; // { dg-error "duplicate base|forward declaration" } -struct C : A, B {}; // { dg-error "duplicate base" } +struct C : A, B {}; // { dg-error "duplicate base|invalid use" } -C c; +C c; // { dg-error "aggregate" }