re PR c++/42061 ([c++0x] ICE with invalid initializer list for reference)

PR c++/42061
	* call.c (reference_binding): Return NULL for initializer list with
	error operand inside of it.

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

From-SVN: r154240
This commit is contained in:
Jakub Jelinek 2009-11-17 08:26:52 +01:00 committed by Jakub Jelinek
parent a7a77d0221
commit 90657f0d79
4 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2009-11-17 Jakub Jelinek <jakub@redhat.com>
PR c++/42061
* call.c (reference_binding): Return NULL for initializer list with
error operand inside of it.
PR c++/42059
* typeck.c (cp_build_modify_expr): For initializer list call
check_array_initializer to make sure lhs isn't a VLA.

View File

@ -1218,6 +1218,8 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
&& CONSTRUCTOR_NELTS (expr) == 1)
{
expr = CONSTRUCTOR_ELT (expr, 0)->value;
if (error_operand_p (expr))
return NULL;
from = TREE_TYPE (expr);
}
}

View File

@ -1,5 +1,8 @@
2009-11-17 Jakub Jelinek <jakub@redhat.com>
PR c++/42061
* g++.dg/cpp0x/initlist27.C: New test.
PR c++/42059
* g++.dg/cpp0x/initlist26.C: New test.

View File

@ -0,0 +1,5 @@
// PR c++/42061
// { dg-do compile }
// { dg-options "-std=c++0x" }
int& i = { j }; // { dg-error "invalid initialization|was not declared" }