Currently to avoid ambiguity etc we need to add parentheses when using requires-clause with operator. Also the note in temp.pre says:
[ Note: The expression in a requires-clause uses a restricted grammar to avoid ambiguities.
Parentheses can be used to specify arbitrary expressions in a requires-clause.
[ Example:
template<int N> requires N == sizeof new unsigned short
int f(); // error: parentheses required around == expression
— end example]
— end note]
But then in temp.constr.decl one of the example uses the requires-clause with && without parentheses:
As we can see, while declaring f5 the && operator is used in the require-clause without the parentheses but as previously mentioned in temp.pre#8.3, the parentheses should be used.
Actually, as explained here, c++ grammar allows omitting parentheses for || and && but not for other operators. That is, requires has custom behavior for these two operators(|| and &&).
Full name of submitter : Anoop Rana
Reference (section label): [temp.constr.decl]
Issue description:
Currently to avoid ambiguity etc we need to add parentheses when using requires-clause with operator. Also the note in temp.pre says:
But then in temp.constr.decl one of the example uses the requires-clause with
&&
without parentheses:As we can see, while declaring
f5
the&&
operator is used in the require-clause without the parentheses but as previously mentioned in temp.pre#8.3, the parentheses should be used.