Why give a C++ compiler warning when returning an rvalue reference?
问题 I've been studying rvalue references (a new concept for me), and am puzzled by a warning I receive in the following class function... string&& Sampler::Serial() const { stringstream ss; . . [assemble a string value using data members] . return ss.str(); } This compiles successfully, but with the following warning... ..\Metrics\Sampler.cpp:71:16: warning: returning reference to temporary [-Wreturn-local-addr] return ss.str(); ^ I'm fully aware that I'm returning a temporary, as evidenced by