Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expr.pre] p3 "operators that are overloaded" is not a defined term #6190

Open
xmh0511 opened this issue Mar 15, 2023 · 4 comments
Open

[expr.pre] p3 "operators that are overloaded" is not a defined term #6190

xmh0511 opened this issue Mar 15, 2023 · 4 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Mar 15, 2023

[expr.pre] p3 says

Subclause [expr.compound] defines the effects of operators when applied to types for which they have not been overloaded.

We just say a function operator implements an operator, as per [over.oper.general] p1. We didn't define "an operator is/is not overloaded". If a class type does not have any user-defined function operator/template, is it? Moreover, [over.match.oper] p1 says

If no operand of an operator in an expression has a type that is a class or an enumeration, the operator is assumed to be a built-in operator and interpreted according to [expr.compound].

So, [expr.pre] p3 can be changed to

Subclause [expr.compound] defines the effects of operators when applied to types that are neither class nor enumeration type.

This is concise and clear.

@frederick-vs-ja
Copy link
Contributor

I think this shorter form is OK:

[...] when no operator function is selected.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Mar 16, 2023

[...] when no operator function is selected.

But, the built-in operators for built-in types are not considered to be operator functions.

[over.built] p1

The candidate operator functions that represent the built-in operators defined in [expr.compound] are specified in this subclause.
These candidate functions participate in the operator overload resolution process as described in [over.match.oper] and are used for no other purpose.

@frederick-vs-ja
Copy link
Contributor

But, the built-in operators for built-in types are not considered to be operator functions.

Yes, this is exactly the reason why I suggested the shorter form. I think the sentence should just mean that the effects of built-in operators are covered in [expr.compound].

@xmh0511
Copy link
Contributor Author

xmh0511 commented Mar 16, 2023

But, the built-in operators for built-in types are not considered to be operator functions.

Yes, this is exactly the reason why I suggested the shorter form. I think the sentence should just mean that the effects of built-in operators are covered in [expr.compound].

"when no operator function is selected" could imply this meaning: there is no viable operator function. However, the built-in types do not have operator functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants