http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58170
Bug ID: 58170 Summary: Crash when aliasing a template class that is a member of its template base class. Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cassio.neri at gmail dot com The code below crashes gcc 4.8.1 (coincidentaly, it also crashes clang 3.3). --------------------------------------------------------------------- template <typename T, typename U> struct base { template <typename V> struct derived; }; template <typename T, typename U> template <typename V> struct base<T, U>::derived : public base<T, V> { }; // This (wrong?) alias declaration provoques the crash. template <typename T, typename U, typename V> using derived = base<T, U>::derived<V>; // This one works: // template <typename T, typename U, typename V> // using derived = typename base<T, U>::template derived<V>; template <typename T> void f() { derived<T, bool, char> m{}; (void) m; } int main() { f<int>(); } --------------------------------------------------------------------- $ g++ -v -save-temps -std=c++11 -Wall -pedantic main.cpp Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/gcc/src/gcc-4.8-20130725/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 --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-install-libiberty --disable-multilib --disable-libssp --disable-werror --enable-checking=release Thread model: posix gcc version 4.8.1 20130725 (prerelease) (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-Wall' '-Wpedantic' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus -E -quiet -v -D_GNU_SOURCE main.cpp -mtune=generic -march=x86-64 -std=c++11 -Wall -Wpedantic -fpch-preprocess -o main.ii ignoring nonexistent directory "/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include /usr/local/include /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-Wall' '-Wpedantic' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -Wall -Wpedantic -std=c++11 -version -o main.s GNU C++ (GCC) version 4.8.1 20130725 (prerelease) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.8.1 20130725 (prerelease), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (GCC) version 4.8.1 20130725 (prerelease) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.8.1 20130725 (prerelease), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: fcec9480bd3d120c7e8d40d79394317d main.cpp: In substitution of ‘template<class T, class U, class V> using derived = base<T, U>::derived<V> [with T = T; U = bool; V = char]’: main.cpp:24:24: required from here main.cpp:16:39: internal compiler error: Segmentation fault using derived = base<T, U>::derived<V>; ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.archlinux.org/> for instructions.