summaryrefslogtreecommitdiff
path: root/test/SemaCXX/coroutines.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/coroutines.cpp')
-rw-r--r--test/SemaCXX/coroutines.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/SemaCXX/coroutines.cpp b/test/SemaCXX/coroutines.cpp
index 6394829f356a..65e17abb11fe 100644
--- a/test/SemaCXX/coroutines.cpp
+++ b/test/SemaCXX/coroutines.cpp
@@ -66,6 +66,12 @@ struct suspend_never {
void await_resume() {}
};
+struct auto_await_suspend {
+ bool await_ready();
+ template <typename F> auto await_suspend(F) {}
+ void await_resume();
+};
+
struct DummyVoidTag {};
DummyVoidTag no_specialization() { // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits<DummyVoidTag>' has no member named 'promise_type'}}
co_await a;
@@ -159,6 +165,10 @@ void yield() {
co_yield yield; // expected-error {{no member named 'await_ready' in 'not_awaitable'}}
}
+void check_auto_await_suspend() {
+ co_await auto_await_suspend{}; // Should compile successfully.
+}
+
void coreturn(int n) {
co_await a;
if (n == 0)