| 1 |
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++20 -fcxx-exceptions -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wall -Wextra -Wno-error=unreachable-code |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
#include "Inputs/std-coroutine.h" |
| 5 |
|
| 6 |
using std::suspend_always; |
| 7 |
using std::suspend_never; |
| 8 |
|
| 9 |
struct awaitable { |
| 10 |
bool await_ready(); |
| 11 |
void await_suspend(std::coroutine_handle<>); // FIXME: coroutine_handle |
| 12 |
void await_resume(); |
| 13 |
} a; |
| 14 |
|
| 15 |
struct object { ~object() {} }; |
| 16 |
|
| 17 |
struct promise_void_return_value { |
| 18 |
void get_return_object(); |
| 19 |
suspend_always initial_suspend(); |
| 20 |
suspend_always final_suspend() noexcept; |
| 21 |
void unhandled_exception(); |
| 22 |
void return_value(object); |
| 23 |
}; |
| 24 |
|
| 25 |
struct VoidTagReturnValue { |
| 26 |
struct promise_type { |
| 27 |
VoidTagReturnValue get_return_object(); |
| 28 |
suspend_always initial_suspend(); |
| 29 |
suspend_always final_suspend() noexcept; |
| 30 |
void unhandled_exception(); |
| 31 |
void return_value(object); |
| 32 |
}; |
| 33 |
}; |
| 34 |
|
| 35 |
template <typename T1> |
| 36 |
struct std::coroutine_traits<void, T1> { using promise_type = promise_void_return_value; }; |
| 37 |
|
| 38 |
VoidTagReturnValue test() { |
| 39 |
object x = {}; |
| 40 |
try { |
| 41 |
co_return {}; |
| 42 |
} catch (...) { |
| 43 |
throw; |
| 44 |
} |
| 45 |
} |