Skip to content

[expr.call] Clarify the value of this #5399

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3197,10 +3197,12 @@
int x = f<int>(); // error: no argument for second function parameter
\end{codeblock}
\end{example}
If the function is an implicit object member
function, the \keyword{this} parameter of the function\iref{expr.prim.this}
is initialized with a pointer to the object of the call, converted
as if by an explicit type conversion\iref{expr.cast}.
If the function is an implicit object member function,
the object for which it is invoked\iref{expr.prim.this}
is the object which would be pointed to by the result
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "would"? There is nothing hypothetical here. The member function is invoked for a certain subobject (or possibly the entire object) of the object designated by the object expression.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "would"? There is nothing hypothetical here.

We don't do any code transformations or anything else to make this conversion «really exist».

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do convert the object expression to the type of the base class, and the result of that transformation is the value of "this" inside the member function, in my view.

of an explicit type conversion\iref{expr.cast}
on a pointer pointing to the result of the \termref{object expression}
to the type of \keyword{this} in the body of the function.
\begin{note}
There is no access or ambiguity checking on this conversion; the access
checking and disambiguation are done as part of the (possibly implicit)
Expand Down