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: r194865
This commit is contained in:
parent
0506634a93
commit
b53e053384
3 changed files with 25 additions and 2 deletions
|
@ -1,5 +1,8 @@
|
|||
2013-01-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/55856
|
||||
* semantics.c (build_data_member_initialization): Handle DECL_EXPR.
|
||||
|
||||
PR c++/53650
|
||||
* call.c (type_has_extended_temps): New.
|
||||
* cp-tree.h: Declare it.
|
||||
|
|
|
@ -5848,15 +5848,19 @@ build_data_member_initialization (tree t, vec<constructor_elt, va_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)
|
||||
|
|
16
gcc/testsuite/g++.dg/cpp0x/constexpr-ctor11.C
Normal file
16
gcc/testsuite/g++.dg/cpp0x/constexpr-ctor11.C
Normal 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("");
|
Loading…
Add table
Reference in a new issue