https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120594
Bug ID: 120594
Summary: internal compiler error: tree check: expected class
'type', have 'exceptional' (error_mark) in
template_class_depth, at cp/pt.cc:43 since 15.1
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mario.rodriguezb1 at um dot es
Target Milestone: ---
ICE on:
```
#include <iostream>
namespace apply_details
{
template <size_t N>
struct Func
{
constexpr static void print_invocable = [](auto & i) constexpr noexcept
{
std::cout << i;
++i;
};
}
}
```
Stack dump:
```
<source>:9:72: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in template_class_depth, at cp/pt.cc:438
9 | constexpr static void print_invocable = [](auto & i) constexpr
noexcept
|
^~~~~~~~
0x282f1c5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x284d556 internal_error(char const*, ...)
???:0
0x9e5231 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
???:0
0xbc4e87 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
???:0
0xbdac8c grokmethod(cp_decl_specifier_seq*, cp_declarator const*, tree_node*)
???:0
0xd049b3 c_parse_file()
???:0
0xe6c5b9 c_common_parse_file()
???:0
```
To quickly reproduce:
https://godbolt.org/z/89sWxbGo1