https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114632
Bug ID: 114632 Summary: ICE with explicit this in lambda Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bruck.michael at gmail dot com Target Milestone: --- struct S {}; auto lambda = [](this auto& self, const int x) {}; int main() { void (*func)(S&, int) = lambda; return 0; } https://gcc.godbolt.org/z/3aW1be8PG <source>: In substitution of 'template<class auto:1> constexpr<lambda(this auto:1&, int)>::operator decltype (<lambda(this auto:1&, int)>(static_cast<auto:1&>(self), static_cast<const int&&>(x))) (*)(auto:1&, int)() const [with auto:1 = S]': <source>:7:29: required from here 7 | void (*func)(S&, int) = lambda; | ^~~~~~ <source>:3:15: internal compiler error: Segmentation fault 3 | auto lambda = [](this auto& self, const int x) {}; | ^ 0x26743fc internal_error(char const*, ...) ???:0 0xc9db80 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xc9d2c8 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xc9d032 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xc9d2c8 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xc85143 instantiate_template(tree_node*, tree_node*, int) ???:0 0xcb76d5 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ???:0 0xa8e3bf can_convert_arg_bad(tree_node*, tree_node*, tree_node*, int, int) ???:0 0xd38ca0 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0xb4618e cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int, cp_decomp*) ???:0 0xc5b3ea c_parse_file() ???:0 0xdaf8b9 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 clang compiles this snippet, which is probably incorrect.