]> gcc.gnu.org Git - gcc.git/commitdiff
c++ comment adjustments for 114935
authorJason Merrill <jason@redhat.com>
Tue, 14 May 2024 21:37:08 +0000 (17:37 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 14 May 2024 21:40:09 +0000 (17:40 -0400)
gcc/cp/ChangeLog:

* decl.cc (wrap_cleanups_r): Clarify comment.
* init.cc (build_vec_init): Update comment.

gcc/cp/decl.cc
gcc/cp/init.cc

index 3fc8835154d96947c923e415c645c36e8c49eccc..a139b293e00cac57338722552cddb5e652aac8e5 100644 (file)
@@ -8028,11 +8028,11 @@ wrap_cleanups_r (tree *stmt_p, int *walk_subtrees, void *data)
    Unfortunately, there's no way to express this properly in terms of
    nesting, as the regions for the temporaries overlap the region for the
    variable itself; if there are two temporaries, the variable needs to be
-   the first thing destroyed if either of them throws.  However, we only
-   want to run the variable's cleanup if it actually got constructed.  So
-   we need to guard the temporary cleanups with the variable's cleanup if
-   they are run on the normal path, but not if they are run on the
-   exceptional path.  We implement this by telling
+   the first thing destroyed if either of the temporary destructors throws.
+   However, we only want to run the variable's cleanup if it actually got
+   constructed.  So we need to guard the temporary cleanups with the
+   variable's cleanup if they are run on the normal path, but not if they
+   are run on the exceptional path.  We implement this by telling
    honor_protect_cleanup_actions to strip the variable cleanup from the
    exceptional path.
 
index 7bb98f445c374e16f022a3715d88c8bae2a1d5cb..906e401974cb0181c460c46f312eb10ca8846a79 100644 (file)
@@ -4685,8 +4685,14 @@ build_vec_init (tree base, tree maxindex, tree init,
         for any temporaries in the initialization are naturally within our
         cleanup region, so we don't want wrap_temporary_cleanups to do
         anything for arrays.  But if the array is a subobject, we need to
-        tell split_nonconstant_init how to turn off this cleanup in favor of
-        the cleanup for the complete object.  */
+        tell split_nonconstant_init or cp_genericize_target_expr how to turn
+        off this cleanup in favor of the cleanup for the complete object.
+
+        ??? For an array temporary such as an initializer_list backing array,
+        it would avoid redundancy to leave this cleanup active, clear
+        CLEANUP_EH_ONLY, and not build another cleanup for the temporary
+        itself.  But that breaks when gimplify_target_expr adds a clobber
+        cleanup that runs before the build_vec_init cleanup.  */
       if (cleanup_flags)
        vec_safe_push (*cleanup_flags, build_tree_list (iterator, maxindex));
     }
This page took 0.073503 seconds and 5 git commands to generate.