MSVC (std:c++14) is complaining when initializing an rvalue reference using non-static data member of a prvalue (returned by function call).
The code is as follows (or see Compiler Explorer):
struct R {};struct A { R r; R getR() { return r; }};A getA() { return {}; };int main() { A &&aa = A(); // okay A &&aaa = getA(); // okay R &&rr = getA().r; // should be okay, but not}
Both GCC and Clang seem okay, and MSVC with /std:c++20 is okay as well. Is this a compliance issue of MSVC or am I misunderstanding something?