Please consider the following C++20 program:
struct S {
S(int x) : x(x) {}
int x;
};
S f() { return S(42); }
int main() {
auto&& r = f().x;
return r;
}
Is this undefined behaviour and the reference dangles? or is the int object lifetime extended?