This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33939] Rvalue references not deduced correctly in vararg function templates
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Nov 2007 20:41:13 -0000
- Subject: [Bug c++/33939] Rvalue references not deduced correctly in vararg function templates
- References: <bug-33939-13491@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pcarlini at suse dot de 2007-11-04 20:41 -------
Gosh, this bug is horrible, the -basic- forwarding situation doesn't work with
variadic templates:
void foo(int&&);
void foo(const int&) { }
template<typename _Tp>
struct identity
{
typedef _Tp type;
};
template<typename _Tp>
inline _Tp&&
forward(typename identity<_Tp>::type&& __t)
{ return __t; }
template<typename _Args>
void
bar(_Args&& __args)
{
foo(forward<_Args>(__args));
}
template<typename... _Args>
void
barv(_Args&&... __args)
{
foo(forward<_Args>(__args)...);
}
int main()
{
int a;
bar(a);
barv(a);
}
Doug, any chance you can have a look? Many thanks in advance!
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pcarlini at suse dot de
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-11-04 20:41:13
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33939