re PR c++/42059 ([c++0x] ICE with initializer list for VLA)

PR c++/42059
	* typeck.c (cp_build_modify_expr): For initializer list call
	check_array_initializer to make sure lhs isn't a VLA.

	* g++.dg/cpp0x/initlist26.C: New test.

From-SVN: r154237
This commit is contained in:
Jakub Jelinek 2009-11-17 07:59:13 +01:00 committed by Jakub Jelinek
parent 5a887be717
commit 84526801f6
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-11-17 Jakub Jelinek <jakub@redhat.com>
PR c++/42059
* typeck.c (cp_build_modify_expr): For initializer list call
check_array_initializer to make sure lhs isn't a VLA.
2009-11-16 Jason Merrill <jason@redhat.com>
PR c++/189, c++/9937, c++/13950, DR 176

View File

@ -6239,7 +6239,11 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
int from_array;
if (BRACE_ENCLOSED_INITIALIZER_P (rhs))
rhs = digest_init (lhstype, rhs);
{
if (check_array_initializer (lhs, lhstype, rhs))
return error_mark_node;
rhs = digest_init (lhstype, rhs);
}
else if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),
TYPE_MAIN_VARIANT (TREE_TYPE (rhs))))

View File

@ -1,3 +1,8 @@
2009-11-17 Jakub Jelinek <jakub@redhat.com>
PR c++/42059
* g++.dg/cpp0x/initlist26.C: New test.
2009-11-16 Jason Merrill <jason@redhat.com>
PR c++/189, c++/9937, c++/13950, DR 176

View File

@ -0,0 +1,10 @@
// PR c++/42059
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
void
foo (int i)
{
int a[i];
a = { }; // { dg-error "may not be initialized" }
}