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

            Bug ID: 120287
           Summary: [15/16 Regression] internal compiler error: tree
                    check: expected class 'type', have 'exceptional'
                    (error_mark) in is_std_substitution, at
                    cp/mangle.cc:507
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Starting with r15-2798-g82cd63a63eaa61 we ICE after giving the expected error:

namespace std
{
template<typename T>
constexpr auto format_kind = []{ static_assert(false); }();
}
template<auto> struct S { };
S<std::format_kind<const void>> s;


Bad:  8742 /home/remote/jwakely/gcc-bisect-objs/cc1plus.r15-2798

ice.cc: In instantiation of 'constexpr const auto std::format_kind<const
void>':
ice.cc:7:8:   required from here
    7 | S<std::format_kind<const void>> s;
      |        ^~~~~~~~~~~~~~~~~~~~~~
ice.cc:4:48: error: static assertion failed
    4 | constexpr auto format_kind = []{ static_assert(false); }();
      |                                                ^~~~~
ice.cc:4:48: note: 'false' evaluates to false
ice.cc:4:16: error: deduced type 'const void' for 'std::format_kind<const
void>' is incomplete
    4 | constexpr auto format_kind = []{ static_assert(false); }();
      |                ^~~~~~~~~~~
ice.cc:4:30: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in is_std_substitution, at cp/mangle.cc:508
    4 | constexpr auto format_kind = []{ static_assert(false); }();
      |                              ^
0x2e2f7ea internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:491
0x159a2b8 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/tree.cc:9051
0x408f48 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc/tree.h:3787
0x5f696b is_std_substitution
        ../../gcc/cp/mangle.cc:508
0x5f705d find_substitution
        ../../gcc/cp/mangle.cc:640
0x5fb066 write_prefix
        ../../gcc/cp/mangle.cc:1310
0x5fb53e write_prefix
        ../../gcc/cp/mangle.cc:1362
0x5faf90 write_nested_name
        ../../gcc/cp/mangle.cc:1279
0x5fa517 write_name
        ../../gcc/cp/mangle.cc:1171
0x5f92ff write_encoding
        ../../gcc/cp/mangle.cc:938
0x5f8417 write_mangled_name
        ../../gcc/cp/mangle.cc:820
0x60dfc2 mangle_decl_string
        ../../gcc/cp/mangle.cc:4421
0x60e012 get_mangled_id
        ../../gcc/cp/mangle.cc:4442
0x60e350 mangle_decl(tree_node*)
        ../../gcc/cp/mangle.cc:4480
0x157a585 decl_assembler_name(tree_node*)
        ../../gcc/tree.cc:725
0xa6487d symtab_node::get_comdat_group_id()
        ../../gcc/cgraph.h:258
0xa84f49 analyze_functions
        ../../gcc/cgraphunit.cc:1203
0xa8860f symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.cc:2560
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.

Reply via email to