https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123080
Bug ID: 123080
Summary: ICE when constructing parameter type in requires
clause of lambda
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eczbek.void at gmail dot com
Target Milestone: ---
https://godbolt.org/z/zdGaqYed3
```
template<typename T>
struct type_identity {
using type = T;
};
auto f = [](auto x) requires(requires {
typename type_identity<decltype(x)>::type(0);
}) {};
int main() {
f(0);
}
```
```
<source>:6:10: error: constraints on a non-templated function
6 | auto f = [](auto x) requires(requires {
| ^
<source>:6:18: error: 'x' has incomplete type
6 | auto f = [](auto x) requires(requires {
| ~~~~~^
<source>:8:2: error: invalid use of template type parameter 'auto:1'
8 | }) {};
| ^
<source>: In lambda function:
<source>:8:5: internal compiler error: in type_dependent_expression_p, at
cp/pt.cc:29613
8 | }) {};
| ^
0x291eec8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2913c8b internal_error(char const*, ...)
???:0
0xb1079e fancy_abort(char const*, int, char const*)
???:0
0x18aea3c walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
???:0
0x18b26b7 walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false,
default_hash_traits<tree_node*> >*))
???:0
0xd62d0a instantiation_dependent_expression_p(tree_node*)
???:0
0xddec04 apply_deduced_return_type(tree_node*, tree_node*)
???:0
0xc0cd33 finish_function(bool)
???:0
0xc5b2e2 finish_lambda_function(tree_node*)
???:0
0xd4d423 c_parse_file()
???:0
0xebd0f9 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
```