No, not safe because a reference to a temporary is being kept, like you said. The return value of GetSettings() goes out of scope after a reference to it is stored in refSet. Then again, if you never use refSet you won't have a problem. RVO is irrelevant here, but the behaviour is undefined if you go and use refSet, so you may see differences for different compilers/different systems/even different executions.
On second thought, have you tested this code? I got a compiler error with this. There's actually a weird rule about non-const references surrounding this issue:
Code:
#include <iostream>
int GetInt() { return 3; }
int main()
{
int& x = GetInt();
std::cout << x << std::endl;
return 0;
}
Code:
tempRef.cpp: In function ‘int main()’:
tempRef.cpp:7: error: invalid initialization of non-const reference of type
‘int&’ from a temporary of type ‘int’