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

Reply via email to