Skip to content

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

Closed
@xmh0511

Description

@xmh0511

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions