From: Paolo Carlini Date: Sat, 4 Jun 2016 07:10:58 +0000 (+0000) Subject: re PR c++/70202 (ICE on invalid code on x86_64-linux-gnu in build_simple_base_path... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=909a11ad43c91acda1b74de1a81a67bf3dbe751d;p=gcc.git re PR c++/70202 (ICE on invalid code on x86_64-linux-gnu in build_simple_base_path, at cp/class.c:579) /cp 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-04 Paolo Carlini PR c++/70202 * g++.dg/inherit/crash5.C: New. * g++.dg/inherit/virtual1.C: Adjust. From-SVN: r237089 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0569d842e54..b6c0c98310b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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-03 Patrick Palka PR c++/27100 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e01353d5dc1..2fccc5acf01 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22050,9 +22050,8 @@ 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)) - type = NULL_TREE; + if (type && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) + xref_basetypes (type, bases); done: /* Leave the scope given by the nested-name-specifier. We will diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cd45cda0300..94b4a33dd41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-04 Paolo Carlini + + PR c++/70202 + * g++.dg/inherit/crash5.C: New. + * g++.dg/inherit/virtual1.C: Adjust. + 2016-06-03 Jeff Law PR tree-optimization/71316 diff --git a/gcc/testsuite/g++.dg/inherit/crash5.C b/gcc/testsuite/g++.dg/inherit/crash5.C new file mode 100644 index 00000000000..bce999ccbe5 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/crash5.C @@ -0,0 +1,10 @@ +// PR c++/70202 + +class A +{ + virtual void foo () { } +}; +class B : public A, A { }; // { dg-error "duplicate base type" } + +B b1, &b2 = b1; +A a = b2; diff --git a/gcc/testsuite/g++.dg/inherit/virtual1.C b/gcc/testsuite/g++.dg/inherit/virtual1.C index 08bcbb143cf..1199b815f56 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|forward declaration" } +struct B : A, virtual A {}; // { dg-error "duplicate base" } -struct C : A, B {}; // { dg-error "duplicate base|invalid use" } +struct C : A, B {}; // { dg-error "duplicate base" } -C c; // { dg-error "aggregate" } +C c;