https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115503
Bug ID: 115503 Summary: Explicit deduction guide - Capture parameter pack in lambda - Compiler segfaults Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: thomaspkhealy at yahoo dot com Target Milestone: --- With the trunk version of g++ (dated 15 June 2023), the following program causes the compiler to segfault: template<unsigned> struct Frog { template<typename... Params> Frog(Params&&...){} }; template<typename... Params> Frog(Params&&... args) -> Frog< sizeof([&args...](){}) >; int main(void) { Frog var(1.1, 2.2, 3.3, 4.4); } Here's a godbolt: https://godbolt.org/z/495xrT1c3 Here's the compiler output: <source>: In substitution of 'template<class ... Params> Frog(Params&& ...)-> Frog<sizeof (<lambda>)> [with Params = {double, double, double, double}]': <source>:12:37: required from here 12 | Frog var(1.1, 2.2, 3.3, 4.4 ); | ^ <source>:8:55: internal compiler error: Segmentation fault 8 | Frog(Params&&... args) -> Frog< sizeof([&args...](){}) >; | ^ 0x26c86bc internal_error(char const*, ...) ???:0 0xcc3f7d tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0xcb4f11 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*) ???:0 0xcb7319 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0xcb28ba tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xcb2798 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xc98733 instantiate_template(tree_node*, tree_node*, int) ???:0 0xccbd15 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ???:0 0xa8eb19 perform_dguide_overload_resolution(tree_node*, vec<tree_node*, va_gc, vl_embed> const*, int) ???:0 0xc8ed76 do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int, tree_node*) ???:0 0xb533f1 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int, cp_decomp*) ???:0 0xc6f13a c_parse_file() ???:0 0xdc5989 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.