Why are access to non-static member of reference type lvalue, even when the object is an rvalue?
struct S {
int val;
int& rval = val;
};
int main() {
S{}.val; // xvalue
S{}.rval; // lvalue
}
My expectation would have been that a reference to a “soon to die entity” would also be “soon to die”.
I’d like to understand the rationale of the rule(s).
NB: corresponding rules have been discussed in this post