From d168b3daa6f5aad0f5d57b9ac814dcd6e8243c61 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 17 Nov 2016 16:40:41 -0500 Subject: PR c++/68377 - parenthesized expr in fold-expression * parser.c (cp_parser_fold_expression): Check TREE_NO_WARNING. From-SVN: r242561 --- gcc/cp/parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/cp/parser.c') diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9a5039f..3ab0b68 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4679,7 +4679,9 @@ cp_parser_fold_expression (cp_parser *parser, tree expr1) /* The operands of a fold-expression are cast-expressions, so binary or conditional expressions are not allowed. We check this here to avoid tentative parsing. */ - if (is_binary_op (TREE_CODE (expr1))) + if (EXPR_P (expr1) && TREE_NO_WARNING (expr1)) + /* OK, the expression was parenthesized. */; + else if (is_binary_op (TREE_CODE (expr1))) error_at (location_of (expr1), "binary expression in operand of fold-expression"); else if (TREE_CODE (expr1) == COND_EXPR) -- cgit v1.1