From: Paolo Carlini Date: Wed, 21 Mar 2018 21:19:03 +0000 (+0000) Subject: re PR c++/84972 (ICE: tree check: expected class 'type', have 'exceptional' (error_ma... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e299d4fc1a9a3d30ed9c1b7df743b2fd84c9f03a;p=gcc.git re PR c++/84972 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in extended_tree, at tree.h:5545) /cp 2018-03-21 Paolo Carlini PR c++/84972 * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to error_mark_node when check_array_designated_initializer fails. /testsuite 2018-03-21 Paolo Carlini PR c++/84972 * g++.dg/ext/desig10.C: New. From-SVN: r258746 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fd2f371e836..aa8ba26959b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-03-21 Paolo Carlini + + PR c++/84972 + * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to + error_mark_node when check_array_designated_initializer fails. + 2018-03-21 Jakub Jelinek PR c++/84961 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5f181a5da72..0aa4ac20b53 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5467,7 +5467,9 @@ maybe_deduce_size_from_array_init (tree decl, tree init) failure = 1; } - if (!failure) + if (failure) + TREE_TYPE (decl) = error_mark_node; + else { failure = cp_complete_array_type (&TREE_TYPE (decl), initializer, do_default); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cc81884b4f3..4c88b114fb3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ +2018-03-21 Paolo Carlini + + PR c++/84972 + * g++.dg/ext/desig10.C: New. + 2018-03-21 Thomas Koenig - Harald Anlauf + Harald Anlauf PR fortran/84957 * gfortran.dg/pr84957.f90: New test. diff --git a/gcc/testsuite/g++.dg/ext/desig10.C b/gcc/testsuite/g++.dg/ext/desig10.C new file mode 100644 index 00000000000..24057dd0ad6 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/desig10.C @@ -0,0 +1,4 @@ +// PR c++/84972 +// { dg-additional-options "-w" } + +char(a[])({.a = 0}); // { dg-error "designated initializer" }