]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: fix conversion issues
authorJason Merrill <jason@redhat.com>
Tue, 24 Dec 2024 00:57:56 +0000 (19:57 -0500)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 5 May 2025 22:31:02 +0000 (23:31 +0100)
back-port the coroutine part of this.

Some issues caught by a check from another patch:

In build_ramp_function, we're assigning REFERENCE_TYPE things, so we need to
build the assignment directly rather than rely on functions that implement
C++ semantics.

gcc/cp/ChangeLog:

* coroutines.cc (cp_coroutine_transform::build_ramp_function): Build
INIT_EXPR directly.

(cherry picked from commit dd3f3c71df66ed6fd3872ab780f5813831100d1c)

gcc/cp/coroutines.cc

index 77067be45ad403e73e0e9a5463e5e5537b98ca20..09e2f34106277c057dbeebdcd7352655110c455e 100644 (file)
@@ -5093,8 +5093,8 @@ morph_fn_to_coro (tree orig, tree *resumer, tree *destroyer)
 
          if (parm.rv_ref || parm.pt_ref)
            /* Initialise the frame reference field directly.  */
-           r = cp_build_modify_expr (fn_start, TREE_OPERAND (fld_idx, 0),
-                                     INIT_EXPR, arg, tf_warning_or_error);
+           r = build2 (INIT_EXPR, TREE_TYPE (arg),
+                       TREE_OPERAND (fld_idx, 0), arg);
          else
            {
              r = forward_parm (arg);