Lifetime of rvalue bound to static const reference
Consider this: std::string foo(); void bar() { const std::string& r1 = foo(); static const std::string& r2 = foo(); } I know that the lifetime of the string resulting from the first call to foo() will be extended to the lifetime of r1 . What about the temporary bound to r2 , though? Will it live until the end of the scope or will it still be there when bar() is re-entered? Note: I am not interested whether a particular compiler does so. (I am interested in the one we use, and I can test easily with that.) I want to know what the standard has to say on this. The temporary is extended to the