PR c++/68377 - parenthesized expr in fold-expression
* parser.c (cp_parser_fold_expression): Check TREE_NO_WARNING. From-SVN: r242561
This commit is contained in:
parent
77b384c53f
commit
d168b3daa6
3 changed files with 23 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-11-17 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/68377
|
||||
* parser.c (cp_parser_fold_expression): Check TREE_NO_WARNING.
|
||||
|
||||
2016-11-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/78373
|
||||
|
|
|
@ -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)
|
||||
|
|
15
gcc/testsuite/g++.dg/cpp1z/fold8.C
Normal file
15
gcc/testsuite/g++.dg/cpp1z/fold8.C
Normal file
|
@ -0,0 +1,15 @@
|
|||
// PR c++/68377
|
||||
// { dg-options -std=c++1z }
|
||||
|
||||
struct Sink { } s;
|
||||
template <class T> Sink& operator<<(Sink&, const T&);
|
||||
|
||||
template<class... Tx>
|
||||
int f(Tx... xs) {
|
||||
return ((xs+1) + ...);
|
||||
}
|
||||
|
||||
int main() {
|
||||
s << f(3,4,5) << "\n";
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue