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  <paolo.carlini@oracle.com>

	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  <paolo.carlini@oracle.com>

	PR c++/84972
	* g++.dg/ext/desig10.C: New.

From-SVN: r258746
This commit is contained in:
Paolo Carlini 2018-03-21 21:19:03 +00:00
parent 482768bd6b
commit e299d4fc1a
4 changed files with 19 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
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 <jakub@redhat.com>
PR c++/84961

View file

@ -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);

View file

@ -1,5 +1,10 @@
2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84972
* g++.dg/ext/desig10.C: New.
2018-03-21 Thomas Koenig <tkoenig@gcc.gnu.org>
Harald Anlauf <anlauf@gmx.de>
Harald Anlauf <anlauf@gmx.de>
PR fortran/84957
* gfortran.dg/pr84957.f90: New test.

View file

@ -0,0 +1,4 @@
// PR c++/84972
// { dg-additional-options "-w" }
char(a[])({.a = 0}); // { dg-error "designated initializer" }