Bug 44167 - [C++0x] ICE in tsubst_copy at cp/pt.c:10077
Summary: [C++0x] ICE in tsubst_copy at cp/pt.c:10077
Status: RESOLVED DUPLICATE of bug 48292
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
: 44168 (view as bug list)
Depends on:
Reported: 2010-05-17 13:49 UTC by Marc Hofmann
Modified: 2011-05-24 12:44 UTC (History)
1 user (show)

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

Testcase source file. (320 bytes, text/x-c++src)
2010-05-17 13:51 UTC, Marc Hofmann
Preprocessed file. (7.15 KB, application/octet-stream)
2010-05-17 13:55 UTC, Marc Hofmann

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Hofmann 2010-05-17 13:49:39 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.


// 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...);


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

Comment 1 Marc Hofmann 2010-05-17 13:51:03 UTC
Created attachment 20680 [details]
Testcase source file.
Comment 2 Jonathan Wakely 2010-05-17 13:55:07 UTC
*** Bug 44168 has been marked as a duplicate of this bug. ***
Comment 3 Marc Hofmann 2010-05-17 13:55:13 UTC
Created attachment 20682 [details]
Preprocessed file.

Created with:

g++ -save-temps -Wall -std=c++0x testcase.cc -o testcase
Comment 4 Jonathan Wakely 2010-05-17 14:00:51 UTC
4.5 doesn't ICE

pr44167.cc: In function 'int main()':
pr44167.cc:7:44: sorry, unimplemented: use of 'type_pack_expansion' in template
pr44167.cc:41:35: error: no matching function for call to 'apply(int (&)(int, double), std::tuple<int, double>)'

possibly a dup of bug 43382
Comment 5 Jonathan Wakely 2010-05-17 14:03:35 UTC
(In reply to comment #4)
> possibly a dup of bug 43382

actually I don't think it is a dup, because 43382 crashes with 4.5

Comment 6 Jonathan Wakely 2011-05-24 12:44:35 UTC
this is the same as PR 48292, with g++ 4.4 both test cases ICE at the same place in tsubst_copy and with later versions both give the same "sorry, unimplemented" message

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