Bug 44168 - ICE in tsubst_copy at cp/pt.c:10077
Summary: ICE in tsubst_copy at cp/pt.c:10077
Status: RESOLVED DUPLICATE of bug 44167
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-17 13:51 UTC by Marc Hofmann
Modified: 2010-05-17 13:55 UTC (History)
1 user (show)

See Also:
Host:
Target: i486-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Hofmann 2010-05-17 13:51:43 UTC
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
Comment 1 Jonathan Wakely 2010-05-17 13:55:07 UTC

*** This bug has been marked as a duplicate of 44167 ***