The core of your question: can rvalues ββbe bound to non-const lvalue values?
The standard states no . rvalues ββcan only be associated with const lvalue references.
I consider the relevant paragraph of Standard 8.5.3 / 5 :
A reference to type "cv1 T1" is initialized by an expression of type "cv2 T2" as follows:
...
- Otherwise, the reference must be an lvalue reference to the non-volatile type const (i.e. cv1 must be const) or the reference must be an rvalue reference.
However, Microsoft has a long-standing βfeatureβ that allows non-standard behavior, which explains what you are observing.
source share