The following code (see below) triggers an ICE.

Command line:

g++ -save-temps -Wall -std=c++0x testcase.cc -o testcase


Error message:

testcase.cc: In function ‘int main()’:
testcase.cc:42: internal compiler error: in tsubst_copy, at cp/pt.c:10077
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.


Code:

// file: testcase.cc
#include <tuple>

template<unsigned int N>
struct Apply_aux
{
   template<typename F, typename T, typename... X>
   static auto apply(F f, const T& t, X... x)
     -> decltype(Apply_aux<N-1>::apply(f, t, std::get<N-1>(t), x...))
   {
     return Apply_aux<N-1>::apply(f, t, std::get<N-1>(t), x...);
   }

};

template<>
struct Apply_aux<0>
{
   template<typename F, typename T, typename... X>
   static auto apply(F f, const T&, X... x)
     -> decltype(f(x...))
   {
     return f(x...);
   }

};

template<typename F, typename T>
auto apply(F f, const T& t)
  -> decltype(Apply_aux<std::tuple_size<T>::value>::apply(f, t))
{
  return Apply_aux<std::tuple_size<T>::value>::apply(f, t);
}

int f(int p1, double p2)
{
   return 0;
}

int main()
{
  apply(f, std::make_tuple(1, 2.0));
}
// end file: testcase.cc


Output of 'gcc -v':

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)


Output of 'uname -a':

Linux wwz-comamh-166 2.6.32-22-generic #33-Ubuntu SMP Wed Apr 28 13:27:30 UTC
2010 i686 GNU/Linux


Thanks,
Marc


-- 
           Summary: ICE in tsubst_copy at cp/pt.c:10077
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marc dot hofmann at gmail dot com
GCC target triplet: i486-linux-gnu


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

Reply via email to