https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106689
Bug ID: 106689 Summary: gcc crash while compiling a generic lambda Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Target Milestone: --- Reproducing the crash is easy, clone my repository: https://github.com/user1095108/sq2 then compile: g++ -std=c++20 -Ofast sq2.cpp -s -o sq2 -lsqlite3 In file included from sq2.cpp:5: sq2.hpp: In instantiation of 'sq2::bind<>(std::unique_ptr<sqlite3_stmt, detail::sqlite3_stmt_deleter>&, double&&, int&&) requires bool(sizeof ... ((sq2::bind::a ...)))::<lambda(std::index_sequence<J ...>)> [with auto ...J = {0, 1}; std::index_sequence<J ...> = std::integer_sequence<long unsigned int, 0, 1>]': sq2.hpp:172:6: required from 'auto sq2::bind(auto:26&&, auto:27&& ...) requires bool(sizeof ... ((sq2::bind::a ...))) [with int I = 1; auto:26 = std::unique_ptr<sqlite3_stmt, detail::sqlite3_stmt_deleter>&; auto:27 = {double, int}]' sq2.cpp:62:14: required from here sq2.hpp:108:11: internal compiler error: trying to capture 'a#0' in instantiation of generic lambda 108 | [&a, &r, s(detail::get(stmt))]() noexcept -> bool | ^ 0x19ea8d8 internal_error(char const*, ...) ???:0 0x71c477 add_capture(tree_node*, tree_node*, tree_node*, bool, bool) ???:0 0x71c4e3 add_default_capture(tree_node*, tree_node*, tree_node*) ???:0 0x7e224a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ???:0 0x7e0aca tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ???:0 0x7f7957 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0x7e205f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ???:0 0x7e05c7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ???:0 0x7e8cac tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) ???:0 0x7dfea9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ???:0 0x7daf63 instantiate_decl(tree_node*, bool, bool) ???:0 0x6edadb mark_used(tree_node*, int) ???:0 0x68b81f build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0x810e4d finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ???:0 0x7e1e2c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ???:0 0x7daf63 instantiate_decl(tree_node*, bool, bool) ???:0 0x6edadb mark_used(tree_node*, int) ???:0 0x68ad5b build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0x810680 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ???:0 0x7c79bc c_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://bugs.archlinux.org/> for instructions. uname -a Linux e5-2620v2 5.19.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 17 Aug 2022 13:48:51 +0000 x86_64 GNU/Linux clang 14 also crashes. Amazing, but we don't care.