https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119574
Bug ID: 119574
Summary: [15 regression] ICE on lambda in default template
argument
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cmingyi01 at gmail dot com
Target Milestone: ---
The following C++20 code causes an ICE in trunk.
```
template <class F = decltype([] <auto G = [] {}> () {})>
void f(F op = {}) { op(); }
int main() { f(); }
```
Output:
```
<source>: In substitution of 'template<auto G> <lambda()> [with auto G =
<missing>]':
<source>:2:23: required from 'void f(F) [with F = <lambda()>]'
2 | void f(F op = {}) { op(); }
| ~~^~
<source>:4:15: required from here
4 | int main() { f(); }
| ~^~
<source>:1:43: internal compiler error: in add_extra_args, at cp/pt.cc:13743
1 | template <class F = decltype([] <auto G = [] {}> () {})>
| ^~~~~
0x2923895 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x293a866 internal_error(char const*, ...)
???:0
0xacfc3a fancy_abort(char const*, int, char const*)
???:0
0xd44a3d tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0xd35ea1 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
???:0
0xd5206f fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0xb0b412 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
???:0
0xd73595 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0xd1d18d instantiate_decl(tree_node*, bool, bool)
???:0
0xd573db instantiate_pending_templates(int)
???:0
0xbdd080 c_parse_final_cleanups()
???:0
0xe54c58 c_common_parse_file()
???:0
```
See https://compiler-explorer.com/z/49ETTvfas.