https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113584
Bug ID: 113584 Summary: ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jonathan.poelen at gmail dot com Target Milestone: --- A link that reproduces the problem on godbolt (with trunk which is currently gcc 14.0): https://godbolt.org/z/Yn7dEG96e The code compiles with clang. It also compiles if one of the 2 specializations is deleted. The output of -freport-bug with a gcc 13.2 (what I have on my computer). // Target: x86_64-pc-linux-gnu // Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror // Thread model: posix // Supported LTO compression algorithms: zlib zstd // gcc version 13.2.1 20230801 (GCC) // // test2.cpp:25:38: internal compiler error: in unify, at cp/pt.cc:24606 // 25 | using R = normalize_similar2<px<int>>::type; // | ^~ // 0x1ad33c8 internal_error(char const*, ...) // ???:0 // 0x6b7b63 fancy_abort(char const*, int, char const*) // ???:0 // 0x8729fd most_specialized_partial_spec(tree_node*, int) // ???:0 // 0x875849 instantiate_class_template(tree_node*) // ???:0 // 0x8be335 complete_type(tree_node*) // ???:0 // 0x9443d0 c_common_parse_file() // ???:0 // Please submit a full bug report, with preprocessed source. // Please include the complete backtrace with any bug report. // See <https://bugs.archlinux.org/> for instructions. // /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1plus -quiet -D_GNU_SOURCE test2.cpp -quiet -dumpdir a- -dumpbase test2.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -fsyntax-only -freport-bug -o - -frandom-seed=0 -fdump-noaddr # 0 "test2.cpp" # 0 "<built-in>" # 0 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 0 "<command-line>" 2 # 1 "test2.cpp" template<template<class T, T...> class Tpl> struct tpl_type2; template<template<class, unsigned...> class Tpl> struct tpl_type3; template<class T> struct normalize_similar2 {}; template<class T, template<class, T...> class Tpl, T... xs> struct normalize_similar2<Tpl<T, xs...>> { using type = tpl_type2<Tpl>; }; template<template<class, unsigned...> class Tpl, class T, unsigned... N> struct normalize_similar2<Tpl<T, N...>> { using type = tpl_type3<Tpl>; }; template<class T, T...> struct px; using R = normalize_similar2<px<int>>::type;