re PR c++/81055 (ICE with invalid initializer for array new)

/cp
2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/81055
	* init.c (build_vec_init): Avoid building an INIT_EXPR with
	error_mark_node as second argument.

/testsuite
2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/81055
	* g++.dg/cpp0x/new2.C: New.

From-SVN: r256438
This commit is contained in:
Paolo Carlini 2018-01-10 16:37:22 +00:00 committed by Paolo Carlini
parent 389578d7a6
commit 143aa5cc4a
4 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81055
* init.c (build_vec_init): Avoid building an INIT_EXPR with
error_mark_node as second argument.
2018-01-09 Jakub Jelinek <jakub@redhat.com>
PR c++/83734

View File

@ -4399,7 +4399,9 @@ build_vec_init (tree base, tree maxindex, tree init,
if (TREE_CODE (init) == TREE_LIST)
init = build_x_compound_expr_from_list (init, ELK_INIT,
complain);
elt_init = build2 (INIT_EXPR, type, to, init);
elt_init = (init == error_mark_node
? error_mark_node
: build2 (INIT_EXPR, type, to, init));
}
}

View File

@ -1,3 +1,8 @@
2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81055
* g++.dg/cpp0x/new2.C: New.
2018-01-10 H.J. Lu <hongjiu.lu@intel.com>
PR target/83735

View File

@ -0,0 +1,4 @@
// PR c++/81055
// { dg-do compile { target c++11 } }
int** p = new int*[1]{q}; // { dg-error "not declared" }