https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119385
Bug ID: 119385
Summary: internal compiler error when referencing parameters in
require clauses in lambda expressions
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: liuxf19 at 163 dot com
Target Milestone: ---
The following code:
void func() {
[](auto x) requires requires {
[]<int = 0>(int = x) {}();
} {}(0);
}
when compiling with GCC 14.2.0 with:
$ g++ -std=c++20 -fconcepts-diagnostics-depth=5 -freport-bug
g++ gives the following errors:
<source>: In substitution of 'template<class auto:1> func()::<lambda(auto:1)>
[with auto:1 = int]':
<source>:4:9: required from here
2 | [](auto x) requires requires {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 | []<int = 0>(int = x) {}();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
4 | } {}(0);
| ~~~~^~~
<source>:3:32: internal compiler error: in tsubst_expr, at cp/pt.cc:21462
3 | []<int = 0>(int = x) {}();
| ~~~~~~~~~~~~~~~~~~~~~~~^~
0x2031cbc internal_error(char const*, ...)
???:0
0x77895f fancy_abort(char const*, int, char const*)
???:0
0x92ee22 tsubst_default_argument(tree_node*, int, tree_node*, tree_node*, int)
???:0
0x793d8b convert_default_arg(tree_node*, tree_node*, tree_node*, int, int)
???:0
0x7a2143 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
???:0
0x960f6f finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0x7dc7d6 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x7ddec8 constraints_satisfied_p(tree_node*, tree_node*)
???:0
0x94aedc fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x7a1d01 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
???:0
0x960f6f finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0x90ee14 c_parse_file()
???:0
0xa0d1b9 c_common_parse_file()
???:0
The error in this code should be that the function parameter x is incorrectly
used as a default argument, but the compiler crashed instead of reporting this
error.