I ask this question because of the confusion in the accepted answer to the following question:
Why can't we initialize the link to const int
using rvalue volatile int&&
?
In case 1, in the question indicated there, as it should be, in the following section mentioned in the standard:
If the initializer expression is an xvalue value (but not a bit field), the prvalue class, array prvalue value, or function lvalue value and "cv1 T1" refer to "cv2 T2" or
According to my information, it should not appear in this section because the xvalue returned volatile int && bar()
is volatile and const int &
not a reference, compatible with volatile
xvalue, and therefore it must go to the very last part of the help initialization is the same as in case 2, and temporary should be created, and case 1 should also be referred to as case2.
Please help me clarify this.
source
share