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

            Bug ID: 122628
           Summary: [16 Regression] ICE: tree check: expected none of
                    template_decl, have template_decl in
                    instantiating_tu_local_entity, at cp/module.cc:14245
                    with -fmodules
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 62752
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62752&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-g++ -fmodules testcase.C
testcase.C: In instantiation of 'void bar(T) [with T = int]':
required from here
testcase.C:7:6:   
    7 |   bar(0);
      |   ~~~^~~
testcase.C:2:47: internal compiler error: tree check: expected none of
template_decl, have template_decl in instantiating_tu_local_entity, at
cp/module.cc:14245
    2 | template <typename T> static void bar(T) { baz(0); }
      |                                            ~~~^~~
0x319224f internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa434ee tree_not_check_failed(tree_node const*, char const*, int, char const*,
...)
        /repo/gcc-trunk/gcc/tree.cc:9226
0x7ecbe8 tree_not_check(tree_node*, char const*, int, char const*, tree_code)
        /repo/gcc-trunk/gcc/tree.h:3755
0x7ecbe8 instantiating_tu_local_entity(tree_node*)
        /repo/gcc-trunk/gcc/cp/module.cc:14245
0x11e8ad2 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /repo/gcc-trunk/gcc/cp/pt.cc:20854
0x11e916f tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /repo/gcc-trunk/gcc/cp/pt.cc:21681
0x11faecf tsubst_stmt
        /repo/gcc-trunk/gcc/cp/pt.cc:20317
0x11fbfd6 tsubst_stmt
        /repo/gcc-trunk/gcc/cp/pt.cc:19108
0x11fc7d2 tsubst_stmt
        /repo/gcc-trunk/gcc/cp/pt.cc:19511
0x121dc76 tsubst_stmt
        /repo/gcc-trunk/gcc/cp/pt.cc:19076
0x121dc76 instantiate_body
        /repo/gcc-trunk/gcc/cp/pt.cc:28092
0x121ec1f instantiate_decl(tree_node*, bool, bool)
        /repo/gcc-trunk/gcc/cp/pt.cc:28383
0x122ba29 instantiate_pending_templates(int)
        /repo/gcc-trunk/gcc/cp/pt.cc:28458
0x108d6ac c_parse_final_cleanups()
        /repo/gcc-trunk/gcc/cp/decl2.cc:5606
0x13367f0 c_common_parse_file()
        /repo/gcc-trunk/gcc/c-family/c-opts.cc:1436
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g++
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20251110020139-r16-5110-gd538348556bd05-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20251110020139-r16-5110-gd538348556bd05-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20251110 (experimental) (GCC)

Reply via email to