C++ Logo


Advanced search

what is the "glvalue result" in [stmt.return] section

From: jim x <xmh970252187_at_[hidden]>
Date: Wed, 2 Sep 2020 11:02:13 +0800
Hi, everyone.
please forgive me to bother you. I have a question, that is what does
"glvalue result " mean ? Is it a defined terminology wording in the
standard? Please consider the above code.

> int&& func(int& a){
> return std::move(a);
> }
> int main(){
> int a = 0;
> int&& rf = func(a);

The rule in [stmt.return] <
https://timsong-cpp.github.io/cppwp/n4659/stmt.return#2> says that "the
return statement initializes the glvalue result or prvalue result object of
the (explicit or implicit) function call by copy-initialization from the
operand. "

So, please consider this statement "int&& rf = func(a);", what is the
"glvalue result" in this declaration? I'm not sure whether the "glvalue
result" refers to what the following rule says:
>The result of a glvalue is the entity denoted by the *expression*.

if It means that, I have to say that in the declaration "int&& rf =
func(a);" where "rf" is a *declarator-id *rather than an expression, how
could `rf` be called an expression? much less to call it a glvalue. If the
above rule is not actually the definition for "glvalue result", then what
does it refer to?

Received on 2020-09-01 22:05:53