* pt.c (expand_empty_fold): Remove special cases for *,+,&,|.
From-SVN: r234068
+2016-03-08 Jason Merrill <jason@redhat.com>
+
+ P0036R0: Unary Folds and Empty Parameter Packs
+ * pt.c (expand_empty_fold): Remove special cases for *,+,&,|.
+
2016-03-08 Jakub Jelinek <jakub@redhat.com>
PR c++/70135
sequence, the value of the expression is as follows; the program is
ill-formed if the operator is not listed in this table.
- * 1
- + 0
- & -1
- | 0
&& true
|| false
, void() */
if (!FOLD_EXPR_MODIFY_P (t))
switch (code)
{
- case MULT_EXPR:
- return integer_one_node;
- case PLUS_EXPR:
- return integer_zero_node;
- case BIT_AND_EXPR:
- return integer_minus_one_node;
- case BIT_IOR_EXPR:
- return integer_zero_node;
case TRUTH_ANDIF_EXPR:
return boolean_true_node;
case TRUTH_ORIF_EXPR:
MAKE_FNS (sub, -);
int main() {
- assert(unary_left_add() == 0);
+ // assert(unary_left_add() == 0);
assert(unary_left_add(1) == 1);
assert(unary_left_add(1, 2, 3) == 6);
- assert(unary_right_add() == 0);
+ // assert(unary_right_add() == 0);
assert(unary_right_add(1) == 1);
assert(unary_right_add(1, 2, 3) == 6);
MAKE_FN (arrow_star, ->*);
int main() {
- static_assert(add() == int(), "");
- static_assert(mul() == 1, "");
- static_assert(bor() == int(), "");
- static_assert(band() == -1, "");
static_assert(land() == true, "");
static_assert(lor() == false, "");
comma(); // No value to theck
// These are all errors, but the error is emitted at the point
// of instantiation (line 10).
+ add(); // { dg-message "required from here" }
+ mul(); // { dg-message "required from here" }
+ bor(); // { dg-message "required from here" }
+ band(); // { dg-message "required from here" }
sub(); // { dg-message "required from here" }
div(); // { dg-message "required from here" }
mod(); // { dg-message "required from here" }