re PR c++/46289 (ICE in build_constexpr_constructor_member_initializers, at cp/semantics.c:5513)

PR c++/46289
	* semantics.c (build_constexpr_constructor_member_initializers):
	Avoid ICE on error.

From-SVN: r166270
This commit is contained in:
Jason Merrill 2010-11-03 15:13:27 -04:00 committed by Jason Merrill
parent f891030a48
commit 0787e2e7a7
4 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2010-11-03 Jason Merrill <jason@redhat.com>
PR c++/46289
* semantics.c (build_constexpr_constructor_member_initializers):
Avoid ICE on error.
2010-11-02 Dodji Seketeli <dodji@redhat.com> 2010-11-02 Dodji Seketeli <dodji@redhat.com>
* cp-tree.h (enum tsubst_flags)<tf_no_class_instantiations>: * cp-tree.h (enum tsubst_flags)<tf_no_class_instantiations>:

View File

@ -5507,10 +5507,9 @@ build_constexpr_constructor_member_initializers (tree type, tree body)
body = BIND_EXPR_BODY (body); body = BIND_EXPR_BODY (body);
if (TREE_CODE (body) == CLEANUP_POINT_EXPR) if (TREE_CODE (body) == CLEANUP_POINT_EXPR)
ok = build_data_member_initialization (body, &vec); ok = build_data_member_initialization (body, &vec);
else else if (TREE_CODE (body) == STATEMENT_LIST)
{ {
tree_stmt_iterator i; tree_stmt_iterator i;
gcc_assert (TREE_CODE (body) == STATEMENT_LIST);
for (i = tsi_start (body); !tsi_end_p (i); tsi_next (&i)) for (i = tsi_start (body); !tsi_end_p (i); tsi_next (&i))
{ {
ok = build_data_member_initialization (tsi_stmt (i), &vec); ok = build_data_member_initialization (tsi_stmt (i), &vec);
@ -5518,6 +5517,8 @@ build_constexpr_constructor_member_initializers (tree type, tree body)
break; break;
} }
} }
else
gcc_assert (errorcount > 0);
if (ok) if (ok)
return build_constructor (type, vec); return build_constructor (type, vec);
else else

View File

@ -1,3 +1,8 @@
2010-11-03 Jason Merrill <jason@redhat.com>
PR c++/46289
* g++.dg/cpp0x/constexpr-ice3.C: New.
2010-11-03 Eric Botcazou <ebotcazou@adacore.com> 2010-11-03 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt8.ad[sb]: New test. * gnat.dg/opt8.ad[sb]: New test.

View File

@ -0,0 +1,13 @@
// PR c++/46289
// { dg-options -std=c++0x }
struct A
{
int i;
};
struct B
{
A a;
constexpr B(): a({1,2}) { } // { dg-error "" }
};