[Bug c++/99994] New: internal compiler error: trying to capture 'f' in instantiation of generic lambda within constraints_satisfied_p
ed at catmur dot uk
gcc-bugzilla@gcc.gnu.org
Fri Apr 9 12:44:42 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99994
Bug ID: 99994
Summary: internal compiler error: trying to capture 'f' in
instantiation of generic lambda within
constraints_satisfied_p
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ed at catmur dot uk
Target Milestone: ---
In godbolt gcc 11.0.1 20210408:
int main() {
auto f = [](int) { return true; };
return [&](auto i) requires (f(sizeof(i))) { return 99; }(12);
}
In substitution of 'template<class auto:1> main()::<lambda(auto:1)> [with
auto:1 = int]':
3:62: required from here
3:35: internal compiler error: trying to capture 'f' in instantiation of
generic lambda
3 | return [&](auto i) requires (f(sizeof(i))) { return 99; }(12);
| ~~^~~~~~~~~~~~
0x1d00959 internal_error(char const*, ...)
0x800866 add_capture(tree_node*, tree_node*, tree_node*, bool, bool)
0x800bfa add_default_capture(tree_node*, tree_node*, tree_node*)
0x73fdda constraints_satisfied_p(tree_node*, tree_node*)
0x955913 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
0x6e2ace build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
0x981ab5 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
0x8e224d c_parse_file()
0xa612e2 c_common_parse_file()
Without the default-capture the program is rejected with
note: constraints not satisfied
[...]
error: 'f' is not captured
which I think is incorrect since `f` is not odr-used; clang and MSVC accept
either way.
More information about the Gcc-bugs
mailing list