| 1 |
// { dg-do compile } |
| 2 |
// { dg-skip-if "requires hosted libstdc++ for chrono" { ! hostedlib } } |
| 3 |
// Test we create co_await_expr with dependent type rather than type of awaitable class |
| 4 |
|
| 5 |
#include "../coro.h" |
| 6 |
#include "../coro1-ret-int-yield-int.h" |
| 7 |
#include <chrono> |
| 8 |
|
| 9 |
struct TestAwaiter { |
| 10 |
int recent_test; |
| 11 |
TestAwaiter(int test) : recent_test{test} {} |
| 12 |
bool await_ready() { return true; } |
| 13 |
void await_suspend(coro::coroutine_handle<>) {} |
| 14 |
int await_resume() { return recent_test;} |
| 15 |
void return_value(int x) { recent_test = x;} |
| 16 |
}; |
| 17 |
|
| 18 |
template <typename Rep, typename Period> |
| 19 |
coro1 test_temparg (std::chrono::duration<Rep, Period> dur) |
| 20 |
{ |
| 21 |
auto sum = co_await TestAwaiter(1); |
| 22 |
if (!sum) |
| 23 |
dur.count(); |
| 24 |
co_return 0; |
| 25 |
} |