@FredOverflow mentioned in the C++ chatroom that this
is a rare case of rvalues that have names. The C++0x FDIS mentions under 5.1.1 [expr.prim.general] p4
:
Otherwise, if a member-declarator declares a non-static data member (9.2) of a class X, the expression
this
is a prvalue of type “pointer to X” within the optional brace-or-equal-initializer. It shall not appear elsewhere in the member-declarator. (emphasis mine)
What others are there, if any?
true
andfalse
are prvalues of type bool.nullptr
is a prvalue of typenullptr_t
.xvalue
in the context of that expression, and anxvalue
is anrvalue
(per §3.10/1).There may be more, but those are all I can think of at the moment (and the third is questionable -- it's really the expression that's the xvalue, but with something like
return x;
(wherex
is a local variable and you're returning the value, not a reference), the name of the variable is the expression. The name really refers to a glvalue, and in the expression that value (but not really the name) gets converted to an xvalue (which is an rvalue).One prominent case are enumerators
The expressions
one
andtwo
are rvalues (more specifically, prvalues in C++0x). Another are template non-type parametersThe expression
P
is an rvalue too (more specifically again, a prvalue in C++0x).