https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125352

            Bug ID: 125352
           Summary: ICE for partial template specializations with template
                    template parameters
           Product: gcc
           Version: 16.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: programmer00001h at gmail dot com
  Target Milestone: ---

Created attachment 64478
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64478&action=edit
Problematic source file. (Not preprocessed as it contains no #include or other
preprocessing directives)

GCC gives an ICE for this C++ source code (saved as `test.cpp`):

template<template<auto...> typename Tp>
struct example{};
template<typename ...Ts,template<Ts...> typename Tp>
struct example<Tp>{
};

when compiling with `g++ -std=c++26 test.cpp`. (note that I believe this code
is ill-formed, and clang rejects it; however, in any case, the compiler itself
should not crash.)

Backtrace:

test.cpp:4:18: internal compiler error: Segmentation fault
    4 | struct example<Tp>{
      |                  ^
0x27e6438 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x27e8a47 internal_error(char const*, ...)
        ???:0
0x96ef0b tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x96434f coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
        ???:0
0x964575 coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
        ???:0
0x9695dc lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int)
        ???:0
0x9d0e80 finish_template_type(tree_node*, tree_node*, int)
        ???:0
0xaaa200 c_common_parse_file()
        ???:0
/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/cc1plus -quiet -D_GNU_SOURCE test.cpp
-quiet -dumpdir a- -dumpbase test.cpp -dumpbase-ext .cpp -mtune=generic
-march=x86-64 -std=c++26 -o /tmp/cc0Nw80K.s



gcc -v output:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --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 --disable-fixincludes
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.1.1 20260430 (GCC)
  • [Bug c++/125352] New: ICE f... programmer00001h at gmail dot com via Gcc-bugs

Reply via email to