Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/coroutines/co-await-syntax-09-convert.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 // { dg-additional-options "-std=c++17 -w" } | |
2 | |
3 #include "coro.h" | |
4 | |
5 class mycoro { | |
6 public: | |
7 class promise_type { | |
8 public: | |
9 std::suspend_always initial_suspend() const noexcept { return {}; } | |
10 std::suspend_always final_suspend() const noexcept { return {}; } | |
11 void unhandled_exception() noexcept { } | |
12 mycoro get_return_object() { return mycoro{}; } | |
13 }; | |
14 }; | |
15 | |
16 class await { | |
17 public: | |
18 bool await_ready() const noexcept { return false; } | |
19 bool await_suspend(std::coroutine_handle<>) noexcept {return true;} | |
20 mycoro await_resume() { return mycoro{}; } | |
21 }; | |
22 | |
23 mycoro foo(mycoro source) { (void) co_await await{}; } |