https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96474
Bug ID: 96474 Summary: Internal compiler error with template struct inside template struct Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lhlaurini at hotmail dot com Target Milestone: --- Tested on Arch Linux (10.1.0) and on the online compiler godbolt.org (10.1.0, 10.2.0 and trunk), all with the same results. The following code (compile with "g++ test.cpp -std=c++17"): template <typename T> struct A { template <typename U = T> struct B { //B() {} }; }; A<int>::B x; outputs: <source>: In substitution of 'template<class U> B()-> A<int>::B<U> [with U = int]': <source>:11:11: required from here <source>:5:12: internal compiler error: in retrieve_specialization, at cp/pt.c:1240 5 | struct B | ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Uncommenting "B() {}", it compiles fine (doesn't link, of course). Bug is not present on 9.3 (also tested on godbolt.org). --- Godbolt.org with "x86-64 gcc 9.3": Target: x86_64-linux-gnu Configured with: ../gcc-9.3.0/configure --prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap --enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,go,d --enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix --with-pkgversion=Compiler-Explorer-Build Thread model: posix gcc version 9.3.0 (Compiler-Explorer-Build) --- Godbolt.org with "x86-64 gcc 10.2": Target: x86_64-linux-gnu Configured with: ../gcc-10.2.0/configure --prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap --enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,go,d --enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix --with-pkgversion=Compiler-Explorer-Build Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.2.0 (Compiler-Explorer-Build)