This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52851] auto&& fails to deduce type in function template
- From: "delong.j at fb dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Apr 2012 19:07:21 +0000
- Subject: [Bug c++/52851] auto&& fails to deduce type in function template
- Auto-submitted: auto-generated
- References: <bug-52851-4@http.gcc.gnu.org/bugzilla/>
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.)