You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not possible to change the precedence, grouping, or number of operands of operators.
The "precedence" is not directly specified in this document, it is implied by the syntaxes of the grammar of expressions. [expr.footnote] p42 says
The precedence of operators is not directly specified, but it can be derived from the syntax.
It is plausible to use syntax in this wording to imply the precedence is not changed.
It is not possible to change the syntax, grouping, or number of operands of operators.
A + B * C;
Assume that A, B, and C are of class types. The expression is interpreted as additive-expression + multiplicative-expression rather than additive-expression * id-expression.
The text was updated successfully, but these errors were encountered:
While I agree that the description of operator overloading should be better integrated into [expr], I disagree that the change "precedence" -> "syntax" is helpful here. The sentence you quote is essentially a note (nothing normative would change if it were omitted), and "precedence" is a lot more specific (and thus easier to understand) than "syntax".
While I agree that the description of operator overloading should be better integrated into [expr]
Yes, this is the subject of #3957 and #5315. The relevant issues that can be fixed by the integration might be #5172, #5401, #5208. Integrate [over.oper] into [expr] would make [expr] self-consistent; any operation that forms an expression should be covered by [expr] regardless of what type of the operand is. [over] should only concern the resolution/selection between two functions. If we integrated [over.oper] into [expr.compound], the quoted rule could be changed as a note.
[over.oper.general] p7 says
The "precedence" is not directly specified in this document, it is implied by the syntaxes of the grammar of expressions. [expr.footnote] p42 says
It is plausible to use syntax in this wording to imply the precedence is not changed.
Assume that
A
,B
, andC
are of class types. The expression is interpreted as additive-expression + multiplicative-expression rather thanadditive-expression * id-expression
.The text was updated successfully, but these errors were encountered: