I'm pretty sure the value category of integer, character, boolean and floating point literals is prvalue.
User defined literals are like function calls, so their value category depends on the return type of the operator function they resolve to.
I'm not clear on string literals. They have type "array of const charx" where charx is some character type.
It says in 3.10:
The value of a literal ... is also a prvalue.
But I think this might not apply to string literals?
What is the value category of a string literal? How did you determine this?
So I'm pretty sure the value category of integer, character, boolean and floating literals are prvalues.
That's correct.
What is the value category of a string literal?
Per Paragraph 5.1.1/1 of the C++11 Standard:
A literal is a primary expression. Its type depends on its form (2.14). A string literal is an lvalue; all other literals are prvalues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With