https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123646
Bug ID: 123646
Summary: [16 Regression] ICE in dependent_type_p, at
cp/pt.cc:29287 via nested lambda template substitution
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jirehguo at tju dot edu.cn
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/oaj1TYbs3
The following c++ code crash gcc trunk.
But gcc 12,13,14,15 with checking is fine.
The bug have same ice location as bug 122561 and bug 115572, but different
stack dump.
Code:
```cpp
template < int > struct bad {
template < auto =
[] {
[]< typename U >(U ) {};
} >
void g(){}
};
template < class >
void f() {
bad< 0 >::g();
}
```
Stack dump:
```
<source>: In substitution of 'template<auto <anonymous> > void bad<0>::g()
[with auto <anonymous> = <missing>]':
required from here
<source>:10:14:
10 | bad< 0 >::g();
| ~~~~~~~~~~~^~
<source>:4:20: internal compiler error: in dependent_type_p, at cp/pt.cc:29287
4 | []< typename U >(U ) {};
| ^~~~~~~~~~~~~~~~~~~~~~~
0x2950618 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29453db internal_error(char const*, ...)
???:0
0xb1eaa6 fancy_abort(char const*, int, char const*)
???:0
0xbfbeec start_preparsed_function(tree_node*, tree_node*, int)
???:0
0xc6dbc9 start_lambda_function(tree_node*, tree_node*)
???:0
0xd8eb49 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0xd8ecbe tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0xda0111 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
???:0
0xdca431 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0xb4024b build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
???:0
0xe02853 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0xd647e3 c_parse_file()
???:0
0xeee929 c_common_parse_file()
???:0
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.
Compiler returned: 1
```