There's an entry in the errata of Effective Modern C++ which says that
not all names are lvalues
What are these names? Specifically,
nullptr
and this
named prvalues?nullptr
special with respect to true
and false
? They are all values of some type (true
/false
of type bool
, nullptr
of type std::nullptr_t
). After all true
stays to bool
just like 1
stays to int
, and 1
is not a "name which is not an lvalue", is it? At this point I'd ask why is true
not a name then?An expression X
where X
is the name of an enumerator (declared e.g. as enum E { X };
) has rvalue value category.
Similarly for non-type template parameters (hat tip to @PasserBy), as in
template <int X>
int f() { return X; /* X is an rvalue */}