GCC 4.3.2 failed to compile code with vairadic template function
specialization.

Here is the code causing the problem:

template< typename ... T > void foo( T ... args );
template<> void foo( int, double ){}
int main()
{
  foo( 0, 0.0 );
  return 55;
}

I got the following error msg:
test.cpp:3: error: template-id 'foo<>' for 'void foo(int, double)' does not
match any template declaration

However, the specialization using only one parameter can pass:

template< typename ... T > void foo( T ... args );
template<> void foo( int ){}
int main()
{
  foo( 0 );
  return 55;
}

Command used to compile:

g++ -std=c++0x    test.cpp   -o test

Output from -v:

Using built-in specs.
Target: powerpc64-suse-linux
Configured with: ../configure --prefix=/usr --with-local-prefix=/usr/local
--infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64
--libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3
--enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap
--with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch --program-suffix=-4.3
--enable-version-specific-runtime-libs --enable-linux-futex
--without-system-libunwind --with-cpu=power4 --enable-secureplt
--with-long-double-128 --build=powerpc64-suse-linux
Thread model: posix
gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)


-- 
           Summary: Cannot specialize variadic template function
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jichaoz at ca dot ibm dot com
  GCC host triplet: powerpc64-suse-linux


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

Reply via email to