Date: Mon, 23 Dec 2024 22:05:56 +0100
On 23/12/2024 21.05, Vladimir Grigoriev via Std-Discussion wrote:
> In the C++20 Standard in the section 7.6.2.2 «Unary operators» there is written
>
> «1 The unary * operator performs indirection: the expression to which it is applied shall be a pointer to an object type, or a pointer to a function type and the result is an lvalue referring to the object or function to which the expression points. If the type of the expression is “pointer to T”, the type of the result is “T”.»
>
> Should the last statement be written like
>
> «If the type of the expression is “pointer to T”, the type of the result is “T &”»?
No, we say it's an lvalue, and the type is actually "T".
(Arguably, there are no expressions of reference type.)
Jens
> In the C++20 Standard in the section 7.6.2.2 «Unary operators» there is written
>
> «1 The unary * operator performs indirection: the expression to which it is applied shall be a pointer to an object type, or a pointer to a function type and the result is an lvalue referring to the object or function to which the expression points. If the type of the expression is “pointer to T”, the type of the result is “T”.»
>
> Should the last statement be written like
>
> «If the type of the expression is “pointer to T”, the type of the result is “T &”»?
No, we say it's an lvalue, and the type is actually "T".
(Arguably, there are no expressions of reference type.)
Jens
Received on 2024-12-23 21:05:59