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:
parent
bc99421e35
commit
dafed7ca0b
4 changed files with 34 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
19
gcc/testsuite/g++.dg/cpp0x/constexpr-base2.C
Normal file
19
gcc/testsuite/g++.dg/cpp0x/constexpr-base2.C
Normal 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{};
|
Loading…
Add table
Reference in a new issue