New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[basic.lval] p5 value vs initialization #4854
Comments
"The initialization that the expression stores into its context" does not make sense. For all uses of prvalue (except some unevaluated contexts), we ensure a result object is provided (possibly via temporary materialization), so there will always be a value / an object to talk about. What the expression stores might be described by way of initialization ("as-if"), but it's still an expression. Example: I'm willing to consider improvements in the wording here, but sprinkling "initialization" across the normative wording is not helpful. |
Yes, I just meant this meaning. The prvalue records the recipe about how to initialize an object, which is emulated by the model declaration(
IIUC, a prvalue is not always an expression of the grammar. The prvalue also can be produced in a full-expression of the initialization. |
In my mind, the value mentioned in the above rule is used to computes the value of an operand of an operator for the purpose. However, a prvalue is not only for this purpose but also perform initialization. What I want to say is it also store the initialization into its context, which is hinted in [conv.general] p3 and [conv.general] p6
Consider an lvalue-to-rvalue conversion applies to a glvalue of class type, the result of that conversion is defined as
As per [conv.general] p3 and [conv.general] p6, this conversion as if performs that
In this declaration, the copy-initialization is performed like that call a constructor with the argument
glvalue
to initialize the object. In this implicit conversion, thet
is the result of the lvalue-to-rvalue conversion and it is prvalue, hence the modeled initialization will not actually perform except that there exists a result object. I think the value in the definition of the result of a prvalue should have a more general meaning.This modification may make the meaning of the prvalue in the new expression value category system be clearer. In the current, the concept of prvalue especially for class type is intricacy.
The text was updated successfully, but these errors were encountered: