This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Volatile MEMs in statement expressions and functions inlined as trees

On 14 Dec 2001, Gabriel Dos Reis wrote:
> The C++ definition is pretty clear about a return value of class-type:
> it is an rvalue.

I'm saying that that is an arbitrary decision, not a "lack of potential".
You _could_ imagine a language where a class member was always a lvalue.

Classes _have_ to be addressable, because otherwise you cannot call their
member functions and pass them "this". So all class rvalues have the
"option" to upgrade to lvalues.

But I claim that to be a property of the "class"ness, not of the
"rvalue"ness. So a C++ compiler can not promote arbitrary rvalues to
lvalues, but there's a C++ "class action" that does promotion.

Simple example: you claim that you can create a lvalue out of an rvalue.

And I give you the rvalue "1", and dispute your claim. You _cannot_ create
a lvalue out of it. There is none.

But I'll give you that some rvalues can be _promoted_ to lvalues. They
are not lvalues in themselves, but the compiler knows their address and
can, on demand, create a promoted version of the object.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]