You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2 When an lvalue-to-rvalue conversion is applied to an expression E, and either
(2.1) E is not potentially evaluated, or
(2.2) the evaluation of E results in the evaluation of a member Ex of the set of potential results of E, and Ex names a variable x that is not odr-used by Ex
the value contained in the referenced object is not accessed.
I think it means (and should say) the object is not accessed. But this is not the main concern. [conv.lval]/3, which says «The result of the conversion is determined according to the following rules», doesn't seem to cover the case when l-to-r conversion is applied to an evaluated expression denoting an object which is not accessed. I believe the bullet (3.3) saying «Otherwise, the object indicated by the glvalue is read ([defns.access]), and the value contained in the object is the prvalue result» can't apply in case the object is not accessed. Or the implied reading of (3.3) is that the part about access is just ignored for non-accessed objects?
(In case there is doubt that [conv.lval] is applied to a in const int b = a;, it can be replaced with const int b = a + 0;)
The text was updated successfully, but these errors were encountered:
From https://stackoverflow.com/questions/58479267/initialization-order-of-constant-initialized-variable-with-static-storage-durati @sdkrystian
To my understanding, nothing specifies what value
b
will have.Variable
a
is usable in constant expressions, so it is not ODR-used, so [conv.lval]/(2.2) apply:I think it means (and should say) the object is not accessed. But this is not the main concern. [conv.lval]/3, which says «The result of the conversion is determined according to the following rules», doesn't seem to cover the case when l-to-r conversion is applied to an evaluated expression denoting an object which is not accessed. I believe the bullet (3.3) saying «Otherwise, the object indicated by the glvalue is read ([defns.access]), and the value contained in the object is the prvalue result» can't apply in case the object is not accessed. Or the implied reading of (3.3) is that the part about access is just ignored for non-accessed objects?
(In case there is doubt that [conv.lval] is applied to
a
inconst int b = a;
, it can be replaced withconst int b = a + 0;
)The text was updated successfully, but these errors were encountered: