This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33939] New: Rvalue references not deduced correctly in vararg function templates
- From: "eric dot niebler at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Oct 2007 15:34:15 -0000
- Subject: [Bug c++/33939] New: Rvalue references not deduced correctly in vararg function templates
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This is g++ with -std=c++0x flag. The compiler version is g++ (GCC) 4.3.0
20070921 (experimental).
I believe the following code should compile. It does not:
{{{
template<typename T>
struct refs_only;
template<typename T>
struct refs_only<T &>
{};
template<typename T>
refs_only<T> foo( T && t)
{
return refs_only<T>();
}
template<typename... T>
struct va_refs_only;
template<typename T>
struct va_refs_only<T>
: refs_only<T>
{};
template<typename... T>
va_refs_only<T...> bar( T &&... t)
{
return va_refs_only<T...>();
}
int main()
{
int j = 0;
foo(j);
bar(j); // error: invalid use of incomplete type 'struct refs_only<int>'
}
}}}
The use of template varargs should not affect the type that the compiler is
deducing for the parameter {{{j}}}.
--
Summary: Rvalue references not deduced correctly in vararg
function templates
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: eric dot niebler at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33939