re PR c++/46293 (constexpr vs. tuple, ice)

PR c++/46293
	* semantics.c (build_data_member_initialization): Handle
	value-init of aggregate empty base.

From-SVN: r166297
This commit is contained in:
Jason Merrill 2010-11-03 22:15:08 -04:00 committed by Jason Merrill
parent bc99421e35
commit dafed7ca0b
4 changed files with 34 additions and 0 deletions

View file

@ -1,5 +1,9 @@
2010-11-03 Jason Merrill <jason@redhat.com>
PR c++/46293
* semantics.c (build_data_member_initialization): Handle
value-init of aggregate empty base.
PR c++/46289
* call.c (can_convert_array): New fn.
(build_aggr_conv): Use it.

View file

@ -5460,6 +5460,14 @@ build_data_member_initialization (tree t, VEC(constructor_elt,gc) **vec)
{
member = TREE_OPERAND (t, 0);
init = unshare_expr (TREE_OPERAND (t, 1));
if (TREE_CODE (member) == INDIRECT_REF)
{
/* Don't put out anything for value-init of an empty base. */
gcc_assert (is_empty_class (TREE_TYPE (member)));
gcc_assert (TREE_CODE (init) == CONSTRUCTOR
&& CONSTRUCTOR_NELTS (init) == 0);
return true;
}
}
else
{

View file

@ -1,5 +1,8 @@
2010-11-03 Jason Merrill <jason@redhat.com>
PR c++/46293
* g++.dg/cpp0x/constexpr-base2.C: New.
PR c++/46289
* g++.dg/cpp0x/initlist45.C: New.

View file

@ -0,0 +1,19 @@
// PR c++/46293
// { dg-options -std=c++0x }
struct A
{
};
struct C
{
int i;
constexpr C(int i): i(i) {}
};
struct B: A, C
{
constexpr B(): A(), C(42) { }
};
constexpr B b{};