(I asked a variation of this question on comp.std.c++ but didn\'t get an answer.)
Why does the call to f(arg) in this code call the const ref overload of
f(arg)
I did not see the behavior mentioned by Doug on g++. g++ 4.5 and 4.4.3 both call f(string &&) as expected but VS2010 calls f(const string &). Which g++ version are you using?
f(string &&)
f(const string &)