This is the mail archive of the
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlined as trees
- From: Linus Torvalds <torvalds at transmeta dot com>
- To: Gabriel Dos Reis <gdr at codesourcery dot com>
- Cc: Alexandre Oliva <aoliva at redhat dot com>, Richard Henderson <rth at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 14 Dec 2001 11:49:40 -0800 (PST)
- Subject: 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.