+2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
+
+ * coroutines.cc (co_await_expander): Handle type conversion case.
+
2020-01-29 Jason Merrill <jason@redhat.com>
PR c++/90333
&buried_stmt, NULL))
saved_co_await = r;
}
+ else if ((stmt_code == CONVERT_EXPR || stmt_code == NOP_EXPR)
+ && TREE_CODE (TREE_OPERAND (stripped_stmt, 0)) == CO_AWAIT_EXPR)
+ saved_co_await = TREE_OPERAND (stripped_stmt, 0);
if (!saved_co_await)
return NULL_TREE;
default: /* not likely to work .. but... */
append_to_statement_list (resume_call, &stmt_list);
break;
+ case CONVERT_EXPR:
+ case NOP_EXPR:
+ TREE_OPERAND (stripped_stmt, 0) = resume_call;
+ append_to_statement_list (saved_statement, &stmt_list);
+ break;
case INIT_EXPR:
case MODIFY_EXPR:
case CALL_EXPR:
+2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
+
+ * g++.dg/coroutines/co-await-syntax-09-convert.C: New test.
+
2020-01-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92706
* gcc.target/i386/pr93319-1a.c: Don't include <stdio.h>.
(test1): Replace printf with __builtin_printf.
-2020-01-21 Bin Cheng <bin.linux@linux.alibaba.com>
+2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
* g++.dg/coroutines/co-await-void_type.C: New test.
--- /dev/null
+// { dg-additional-options "-std=c++17 -w" }
+
+#include "coro.h"
+
+class mycoro {
+public:
+ class promise_type {
+ public:
+ std::suspend_always initial_suspend() const noexcept { return {}; }
+ std::suspend_always final_suspend() const noexcept { return {}; }
+ void unhandled_exception() noexcept { }
+ mycoro get_return_object() { return mycoro{}; }
+ };
+};
+
+class await {
+public:
+ bool await_ready() const noexcept { return false; }
+ bool await_suspend(std::coroutine_handle<>) noexcept {return true;}
+ mycoro await_resume() { return mycoro{}; }
+};
+
+mycoro foo(mycoro source) { (void) co_await await{}; }