Commit cb8384a3 by Jason Merrill Committed by Jason Merrill

* cvt.c (convert_to_void): Handle null op1.

From-SVN: r170007
parent 69f36ba6
2011-02-09 Jason Merrill <jason@redhat.com> 2011-02-09 Jason Merrill <jason@redhat.com>
* cvt.c (convert_to_void): Handle null op1.
* class.c (type_has_constexpr_default_constructor): Make sure the * class.c (type_has_constexpr_default_constructor): Make sure the
caller stripped an enclosing array. caller stripped an enclosing array.
* init.c (perform_member_init): Strip arrays before calling it. * init.c (perform_member_init): Strip arrays before calling it.
......
...@@ -892,20 +892,24 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain) ...@@ -892,20 +892,24 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
/* The two parts of a cond expr might be separate lvalues. */ /* The two parts of a cond expr might be separate lvalues. */
tree op1 = TREE_OPERAND (expr,1); tree op1 = TREE_OPERAND (expr,1);
tree op2 = TREE_OPERAND (expr,2); tree op2 = TREE_OPERAND (expr,2);
bool side_effects = TREE_SIDE_EFFECTS (op1) || TREE_SIDE_EFFECTS (op2); bool side_effects = ((op1 && TREE_SIDE_EFFECTS (op1))
|| TREE_SIDE_EFFECTS (op2));
tree new_op1, new_op2; tree new_op1, new_op2;
new_op1 = NULL_TREE;
if (implicit != ICV_CAST && !side_effects) if (implicit != ICV_CAST && !side_effects)
{ {
new_op1 = convert_to_void (op1, ICV_SECOND_OF_COND, complain); if (op1)
new_op1 = convert_to_void (op1, ICV_SECOND_OF_COND, complain);
new_op2 = convert_to_void (op2, ICV_THIRD_OF_COND, complain); new_op2 = convert_to_void (op2, ICV_THIRD_OF_COND, complain);
} }
else else
{ {
new_op1 = convert_to_void (op1, ICV_CAST, complain); if (op1)
new_op1 = convert_to_void (op1, ICV_CAST, complain);
new_op2 = convert_to_void (op2, ICV_CAST, complain); new_op2 = convert_to_void (op2, ICV_CAST, complain);
} }
expr = build3 (COND_EXPR, TREE_TYPE (new_op1), expr = build3 (COND_EXPR, TREE_TYPE (new_op2),
TREE_OPERAND (expr, 0), new_op1, new_op2); TREE_OPERAND (expr, 0), new_op1, new_op2);
break; break;
} }
......
2011-02-09 Jason Merrill <jason@redhat.com> 2011-02-09 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/regress/ext-cond1.C: Copy from ext/cond1.C.
* g++.dg/cpp0x/regress/abi-empty7.C: New. * g++.dg/cpp0x/regress/abi-empty7.C: New.
* g++.dg/cpp0x/regress: New directory. * g++.dg/cpp0x/regress: New directory.
......
// PR c++/12515
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
template<int> void foo() { 0 ?: 0; }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment