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

Reword the wording for glvalue result of a function call CWG2495 #4724

Closed
xmh0511 opened this issue Jun 28, 2021 · 1 comment · Fixed by #4803
Closed

Reword the wording for glvalue result of a function call CWG2495 #4724

xmh0511 opened this issue Jun 28, 2021 · 1 comment · Fixed by #4803
Assignees

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jun 28, 2021

As pointed by #4107, #3124, and #3587, the glvalue result is being unclear in the current draft. The glvalue result sometimes has the meaning(namely, anonymous reference) as mentioned in this comment #4107 (comment), but it's not normative wording. I think we should reword the wording for "glvalue result" of a function call to make it more clear. My suggestion is

if the function call is a prvalue, the return statement initializes the prvalue result object of the (explicit or implicit) function call by copy-initialization from the operand.

Otherwise, if the function call is a glvalue, the return statement is equivalent to the following hypothetical declaration

T t = e; if the operand of the return statement is a comma expression X without parenthesis, e is (X), otherwise e is X. T is the return type of the function call;

The invented variable t is the result of the function call.

Here, the invented variable t is the so-called anonymous reference for purpose.

@xmh0511 xmh0511 changed the title Reword the glvalue result of a function call Reword the wording for glvalue result of a function call Jun 28, 2021
@jensmaurer jensmaurer changed the title Reword the wording for glvalue result of a function call Reword the wording for glvalue result of a function call CWG2495 Aug 12, 2021
@jensmaurer
Copy link
Member

Covered by CWG2495; classified as editorial.

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

Successfully merging a pull request may close this issue.

2 participants