https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115431
Bug ID: 115431 Summary: ICE: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in decl_template_parm_check, at cp/cp-tree.h:5131 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Target: x86_64 ******************************************************************************* Internal Compiler Error (ICE) when compiling a specific C++ code with GCC. The error message specifically indicates an issue in decl_template_parm_check at cp/cp-tree.h:5131. ******************************************************************************* OS and Platform: # uname -a Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* #g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /root/gdbtest/gcc/obj/../gcc/configure --prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240509 (experimental) (GCC) ******************************************************************************* Program: # cat constrained.ii template <typename b> struct c { c( b) } template <typename b> struct d : c<b> { c<b>::c; } template <typename b> d(b)->d<b>; d a = [] < e f ******************************************************************************* Command Lines: # g++ -Wall -Wextra -pedantic -Werror -O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -o bug.out constrained.ii constrained.ii:1:45: error: expected ‘;’ at end of member declaration 1 | template <typename b> struct c { c( b) | ^ | ; constrained.ii:2:2: error: expected ‘;’ after struct definition 2 | } template <typename b> struct d : c<b> { | ^ | ; constrained.ii:3:3: error: access declarations are deprecated in favor of using-declarations; suggestion: add the ‘using’ keyword [-Werror=deprecated] 3 | c<b>::c; | ^~~~ constrained.ii:4:2: error: expected ‘;’ after struct definition 4 | } template <typename b> d(b)->d<b>; | ^ | ; constrained.ii:5:10: error: lambda templates are only available with ‘-std=c++20’ or ‘-std=gnu++20’ [-Werror=c++20-extensions] 5 | d a = [] < e f | ^ constrained.ii:5:12: error: ‘e’ has not been declared 5 | d a = [] < e f | ^ constrained.ii:5:15: error: expected ‘>’ at end of input 5 | d a = [] < e f | ^ constrained.ii: In lambda function: constrained.ii:5:15: error: expected ‘{’ at end of input constrained.ii: At global scope: constrained.ii:3:9: internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in decl_template_parm_check, at cp/cp-tree.h:5131 3 | c<b>::c; | ^ 0x99ed98 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) /root/gdbtest/gcc/obj/../gcc/gcc/tree.cc:9169 0x7f386f contains_struct_check(tree_node const*, tree_node_structure_enum, char const*, int, char const*) /root/gdbtest/gcc/obj/../gcc/gcc/tree.h:4058 0x7f386f decl_template_parm_check(tree_node const*, char const*, int, char const*) /root/gdbtest/gcc/obj/../gcc/gcc/cp/cp-tree.h:5131 0x7f386f write_closure_template_head /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:1964 0x7f386f write_closure_type_name /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:1993 0x7f386f write_unqualified_name /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:1591 0xbc78df write_nested_name /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:1280 0xbc7e12 write_class_enum_type /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:3096 0xbc7e12 write_type /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:2515 0xbc715b write_template_args /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:3228 0xbc756f write_prefix /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:1342 0xbc756f write_prefix /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:1293 0xbc78d7 write_nested_name /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:1279 0xbc5276 write_encoding /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:938 0xbc541b write_mangled_name /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:820 0xbcb4e0 mangle_decl_string /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:4420 0xbcb6ca get_mangled_id /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:4441 0xbcb6ca mangle_decl(tree_node*) /root/gdbtest/gcc/obj/../gcc/gcc/cp/mangle.cc:4479 0x16bc0fd decl_assembler_name(tree_node*) /root/gdbtest/gcc/obj/../gcc/gcc/tree.cc:719 0x17354f1 notice_global_symbol(tree_node*) /root/gdbtest/gcc/obj/../gcc/gcc/varasm.cc:1794 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. ******************************************************************************* Also ICE on trunk, compiler explorer:https://godbolt.org/z/es3P1he76 *******************************************************************************