Skip to content
Snippets Groups Projects
Commit 5bdd4c5d authored by Marek Polacek's avatar Marek Polacek
Browse files

c++: Fix bogus -Wparentheses warning with fold-expression [PR94505]

We issue bogus -Wparentheses warnings (3 of them!) for this fold expression:

  ((B && true) || ...)

Firstly, issuing a warning for a compiler-generated expression is wrong
and secondly, B && true must be wrapped in ( ) otherwise you'll get
error: binary expression in operand of fold-expression.

	PR c++/94505 - bogus -Wparentheses warning with fold-expression.
	* pt.c (fold_expression): Add warning_sentinel for -Wparentheses
	before calling build_x_binary_op.

	* g++.dg/cpp1z/fold11.C: New test.
parent c5e4be6b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment