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:
parent
f891030a48
commit
0787e2e7a7
@ -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>
|
||||
|
||||
* cp-tree.h (enum tsubst_flags)<tf_no_class_instantiations>:
|
||||
|
@ -5507,10 +5507,9 @@ build_constexpr_constructor_member_initializers (tree type, tree body)
|
||||
body = BIND_EXPR_BODY (body);
|
||||
if (TREE_CODE (body) == CLEANUP_POINT_EXPR)
|
||||
ok = build_data_member_initialization (body, &vec);
|
||||
else
|
||||
else if (TREE_CODE (body) == STATEMENT_LIST)
|
||||
{
|
||||
tree_stmt_iterator i;
|
||||
gcc_assert (TREE_CODE (body) == STATEMENT_LIST);
|
||||
for (i = tsi_start (body); !tsi_end_p (i); tsi_next (&i))
|
||||
{
|
||||
ok = build_data_member_initialization (tsi_stmt (i), &vec);
|
||||
@ -5518,6 +5517,8 @@ build_constexpr_constructor_member_initializers (tree type, tree body)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
gcc_assert (errorcount > 0);
|
||||
if (ok)
|
||||
return build_constructor (type, vec);
|
||||
else
|
||||
|
@ -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>
|
||||
|
||||
* gnat.dg/opt8.ad[sb]: New test.
|
||||
|
13
gcc/testsuite/g++.dg/cpp0x/constexpr-ice3.C
Normal file
13
gcc/testsuite/g++.dg/cpp0x/constexpr-ice3.C
Normal 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 "" }
|
||||
};
|
Loading…
Reference in New Issue
Block a user