https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94507

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Candidate fix:

--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18876,6 +18877,11 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t
complain, tree in_decl)
       if (oldtmpl)
    {
      tmpl = tsubst_template_decl (oldtmpl, args, complain, fntype);
+     if (tmpl == error_mark_node)
+       {
+         r = error_mark_node;
+         goto out;
+       }
      fn = DECL_TEMPLATE_RESULT (tmpl);
      finish_member_declaration (tmpl);
    }
@@ -18948,6 +18954,7 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t
complain, tree in_decl)
       maybe_add_lambda_conv_op (type);
     }

+out:
   finish_struct (type, /*attr*/NULL_TREE);

   insert_pending_capture_proxies ();

Reply via email to