http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52851
--- Comment #2 from Jordan DeLong <delong.j at fb dot com> 2012-04-03 19:07:21 UTC --- In that case it would be a bug that it works outside of a template, no? But I don't think this is actually supposed to declare an rvalue reference. The && on an auto works more like it does in template argument deduction, and should collapse into an lvalue reference here. (I'm failing to find chapter/verse about this at the moment, but if you look at the definition of range-based for in 6.5.4 it's using auto&& in this way.)