This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/42338] New: [c++0x] ICE on decltype usage with templates
- From: "onay at ee dot bilkent dot edu dot tr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Dec 2009 23:37:17 -0000
- Subject: [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code causes an ICE with segmentation fault:
----------------------------------------------------------------------
#include <iostream>
#include <vector>
template< typename T1 >
void vadd(const std::vector< T1 > &a, decltype(a[0]) t) {
std::cout << "-> ICE \n";
}
void vadd(const std::vector< int > &a, decltype(a[0]) t) {
std::cout << " compiles \n";
}
int main() {
std::vector< int > a;
std::vector< float > b;
int c;
vadd(b,c); // leads to ICE
// vadd(a,c); // compiles
}
----------------------------------------------------------------------
Output of
"g++ -v -save-temps gcc-error-src.cpp -o gcc-error -std=c++0x"
yields:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.2-3'
--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-objc-gc
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.2 (Debian 4.4.2-3)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'gcc-error' '-std=c++0x'
'-shared-libgcc' '-mtune=generic'
/usr/lib/gcc/x86_64-linux-gnu/4.4.2/cc1plus -E -quiet -v -D_GNU_SOURCE
gcc-error-src.cpp -mtune=generic -std=c++0x -fpch-preprocess -o
gcc-error-src.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.4.2/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.4
/usr/include/c++/4.4/x86_64-linux-gnu
/usr/include/c++/4.4/backward
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.4.2/include
/usr/lib/gcc/x86_64-linux-gnu/4.4.2/include-fixed
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'gcc-error' '-std=c++0x'
'-shared-libgcc' '-mtune=generic'
/usr/lib/gcc/x86_64-linux-gnu/4.4.2/cc1plus -fpreprocessed gcc-error-src.ii
-quiet -dumpbase gcc-error-src.cpp -mtune=generic -auxbase gcc-error-src
-std=c++0x -version -o gcc-error-src.s
GNU C++ (Debian 4.4.2-3) version 4.4.2 (x86_64-linux-gnu)
compiled by GNU C version 4.4.2, GMP version 4.3.1, MPFR version
2.4.1-p2.
warning: MPFR header version 2.4.1-p2 differs from library version 2.4.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 76c61736f716d7c937923f7eb86174cd
gcc-error-src.cpp:19: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
--
Summary: [c++0x] ICE on decltype usage with templates
Product: gcc
Version: 4.4.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: onay at ee dot bilkent dot edu dot tr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42338