re PR c++/55856 (ICE on tuple with rvalue ref member)

PR c++/55856
	* semantics.c (build_data_member_initialization): Handle DECL_EXPR.

From-SVN: r194864
This commit is contained in:
Jason Merrill 2013-01-03 13:30:58 -05:00 committed by Jason Merrill
parent 90ffb459a5
commit 806e40346d
3 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2013-01-03 Jason Merrill <jason@redhat.com>
PR c++/55856
* semantics.c (build_data_member_initialization): Handle DECL_EXPR.
2013-01-02 Jason Merrill <jason@redhat.com>
PR c++/54325

View File

@ -5785,15 +5785,19 @@ build_data_member_initialization (tree t, VEC(constructor_elt,gc) **vec)
member = TREE_OPERAND (t, 0);
init = unshare_expr (TREE_OPERAND (t, 1));
}
else
else if (TREE_CODE (t) == CALL_EXPR)
{
gcc_assert (TREE_CODE (t) == CALL_EXPR);
member = CALL_EXPR_ARG (t, 0);
/* We don't use build_cplus_new here because it complains about
abstract bases. Leaving the call unwrapped means that it has the
wrong type, but cxx_eval_constant_expression doesn't care. */
init = unshare_expr (t);
}
else if (TREE_CODE (t) == DECL_EXPR)
/* Declaring a temporary, don't add it to the CONSTRUCTOR. */
return true;
else
gcc_unreachable ();
if (TREE_CODE (member) == INDIRECT_REF)
member = TREE_OPERAND (member, 0);
if (TREE_CODE (member) == NOP_EXPR)

View File

@ -0,0 +1,16 @@
// PR c++/55856
// { dg-options -std=c++11 }
struct A
{
A(const char *);
};
template <class T>
struct B
{
T t;
template <class U> constexpr B(U&& u): t(u) { };
};
B<A&&> b("");