On 3/9/21 10:23 AM, Jakub Jelinek wrote:
On Tue, Mar 09, 2021 at 08:01:26AM -0500, Nathan Sidwell wrote:
thanks for digging into this.  Looks good, but could you take the
opportunity to rewrite the conditionals to a single

if (dummy) { ... do the non-null things ... }

?

So like this?  Bootstrapped/regtested on x86_64-linux and i686-linux.

yeah, great! thank you.

2021-03-09  Jakub Jelinek  <ja...@redhat.com>

        PR c++/99459
        * coroutines.cc (build_co_await): Look through NOP_EXPRs in
        build_special_member_call return value to find the CALL_EXPR.
        Simplify.

--- gcc/cp/coroutines.cc.jj     2021-03-08 14:46:26.845072273 +0100
+++ gcc/cp/coroutines.cc        2021-03-09 14:26:19.867411700 +0100
@@ -863,16 +863,17 @@ build_co_await (location_t loc, tree a,
             final awaiter, so check for a non-throwing DTOR where needed.  */
          tree a_type = TREE_TYPE (a);
          if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (a_type))
-           {
-             tree dummy
+           if (tree dummy
                = build_special_member_call (a, complete_dtor_identifier,
                                             NULL, a_type, LOOKUP_NORMAL,
-                                            tf_none);
-             dummy = dummy ? TREE_OPERAND (CALL_EXPR_FN (dummy), 0)
-                           : NULL_TREE;
-             if (dummy && coro_diagnose_throwing_fn (dummy))
-               return error_mark_node;
-           }
+                                            tf_none))
+             {
+               if (CONVERT_EXPR_P (dummy))
+                 dummy = TREE_OPERAND (dummy, 0);
+               dummy = TREE_OPERAND (CALL_EXPR_FN (dummy), 0);
+               if (coro_diagnose_throwing_fn (dummy))
+                 return error_mark_node;
+             }
        }
      }
    else
@@ -1026,16 +1027,17 @@ build_co_await (location_t loc, tree a,
        if (coro_diagnose_throwing_fn (awrs_func))
        return error_mark_node;
        if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (o_type))
-       {
-         tree dummy
+       if (tree dummy
            = build_special_member_call (e_proxy, complete_dtor_identifier,
                                         NULL, o_type, LOOKUP_NORMAL,
-                                        tf_none);
-         dummy = dummy ? TREE_OPERAND (CALL_EXPR_FN (dummy), 0)
-                       : NULL_TREE;
-         if (dummy && coro_diagnose_throwing_fn (dummy))
-           return error_mark_node;
-       }
+                                        tf_none))
+         {
+           if (CONVERT_EXPR_P (dummy))
+             dummy = TREE_OPERAND (dummy, 0);
+           dummy = TREE_OPERAND (CALL_EXPR_FN (dummy), 0);
+           if (coro_diagnose_throwing_fn (dummy))
+             return error_mark_node;
+         }
      }
/* We now have three call expressions, in terms of the promise, handle and


        Jakub



--
Nathan Sidwell

Reply via email to