Title
Glvalue result of a function call
Status
open
Section
8.7.4 [stmt.return]
Submitter
Jim X

Created on 2021-07-04.00:00:00 last changed 17 months ago

Messages

Date: 2021-08-15.00:00:00

Notes from the August, 2021 teleconference:

A simpler approach would be simply to use a phrase like “returned object or reference” in place of the current wording referring to glvalues and prvalues. This change was regarded as editorial. The issue will remain in "review" status until CWG can look over the wording change.

Date: 2022-02-18.07:47:23

Suggested resolution:

A return statement with any other operand shall be used only in a function whose return type is not cv void;. If the function call is a prvalue, the return statement initializes the glvalue result or prvalue result object of the (explicit or implicit) function call by copy-initialization (9.4 [dcl.init]) from the operand. Otherwise, the return statement is equivalent to the following hypothetical declaration

    T t = e;

If the operand of the return statement, X, is a comma expression without parentheses, 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.

Date: 2022-02-18.07:47:23

According to 8.7.4 [stmt.return] paragraph 1,

A return statement with any other operand shall be used only in a function whose return type is not cv void; the return statement initializes the glvalue result or prvalue result object of the (explicit or implicit) function call by copy-initialization (9.4 [dcl.init]) from the operand.

It is not clear what a “glvalue result” is or what it means to initialize it.

History
Date User Action Args
2022-11-10 14:46:10adminsetstatus: review -> open
2022-02-18 07:47:23adminsetmessages: + msg6724
2021-11-15 00:00:00adminsetmessages: + msg6530
2021-07-04 00:00:00admincreate