You can't use CONVERT_EXPR to convert between two class types, and it was
breaking copy elision.

Unfortunately, this patch breaks symmetric-transfer-00-basic.C, where
susp_type is Loopy<int>::handle_type.  How is this supposed to work?

gcc/cp/ChangeLog:

        * coroutines.cc (expand_one_await_expression): Change conversion
        to assert.
---
 gcc/cp/coroutines.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index eca01abcb7a..568f2edf67d 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -1728,7 +1728,9 @@ expand_one_await_expression (tree *stmt, tree 
*await_expr, void *d)
     }
   else
     {
-      r = build1_loc (loc, CONVERT_EXPR, void_coro_handle_type, suspend);
+      gcc_checking_assert (same_type_ignoring_top_level_qualifiers_p
+                          (void_coro_handle_type, susp_type));
+      r = suspend;
       r = build2_loc (loc, INIT_EXPR, void_coro_handle_type, data->conthand, 
r);
       r = build1 (CONVERT_EXPR, void_type_node, r);
       append_to_statement_list (r, &body_list);

base-commit: 43faf3e5445b571731e52faa1be085ecd0a09323
-- 
2.31.1

Reply via email to