The following code :

======================================
template <typename... T>
struct A {};

template <typename T, typename U>
struct S {};

template <typename... T, typename... U>
A< S<T, U>... > f(U... u)
{ return A< S<T, U>... >(); }

int main()
{
  f<int>(0.0);
}
============================================

compiled with g++ -std=c++0x on today's trunk, produces :

test_variadic_2.cpp: In function 'int main()':
test_variadic_2.cpp:13: error: mismatched argument pack lengths while expanding
'S<T, U>'
test_variadic_2.cpp:13: error: no matching function for call to 'f(double)'


I believe this is a bug, and the code should be accepted.


-- 
           Summary: variadic templates : wrong error "mismatched argument
                    pack lengths"
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sylvain dot pion at sophia dot inria dot fr
  GCC host triplet: i386-apple-darwin9.6.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39863

Reply via email to