https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64398
Bug ID: 64398 Summary: decltype in different contexts with similar expressions triggers segfault in GCC Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: florian.we...@sfz-bw.de The following code triggers an internal segmentation-fault in GCC: ============================================================ template<typename T> struct template1; template<typename T, typename> // second param required struct struct1{ using type1 = decltype(T::x); using type2 = template1<type1>; }; template<typename T> using alias1 = template1<decltype(T::x)>; // just for instantiation: template<typename T> using alias2 = alias1<T>; ============================================================ $ uname -a Linux terra 3.14.27-1-lts #1 SMP Wed Dec 17 19:29:45 CET 2014 x86_64 GNU/Linux $ g++ -v -save-temps -std=c++11 -c demo.cpp Using built-in specs. COLLECT_GCC=g++ Target: x86_64-unknown-linux-gnu Configured with: /build/gcc/src/gcc-4.9.2/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-isl-version-check --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 4.9.2 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/cc1plus -E -quiet -v -D_GNU_SOURCE demo.cpp -mtune=generic -march=x86-64 -std=c++11 -fpch-preprocess -o demo.ii ignoring nonexistent directory "/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/x86_64-unknown-linux-gnu /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/backward /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include /usr/local/include /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/cc1plus -fpreprocessed demo.ii -quiet -dumpbase demo.cpp -mtune=generic -march=x86-64 -auxbase demo -std=c++11 -version -o demo.s GNU C++ (GCC) version 4.9.2 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.2-p10, MPC version 1.0.2 warning: MPFR header version 3.1.2-p10 differs from library version 3.1.2-p11. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (GCC) version 4.9.2 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.2-p10, MPC version 1.0.2 warning: MPFR header version 3.1.2-p10 differs from library version 3.1.2-p11. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: f6f21876c758a79b914bd8c6a01f7890 demo.cpp: In substitution of 'template<class T> using alias1 = template1<struct1<T, <template-parameter-1-2> >::type1> [with T = T]': demo.cpp:12:45: required from here demo.cpp:9:62: internal compiler error: Segmentation fault template<typename T> using alias1 = template1<decltype(T::x)>; ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.archlinux.org/> for instructions. ============================================================