1 // This test merely verifies that emitting the object file does not cause a
2 // crash when the LLVM coroutines passes are run.
3 // RUN: %clang_cc1 -emit-obj -std=c++2a -fsanitize=null %s -o %t.o
6 template <typename R
, typename
... T
> struct coroutine_traits
{
7 using promise_type
= typename
R::promise_type
;
10 template <class Promise
= void> struct coroutine_handle
;
11 template <> struct coroutine_handle
<void> {
12 static coroutine_handle
from_address(void *) noexcept
;
13 coroutine_handle() = default;
14 template <class PromiseType
>
15 coroutine_handle(coroutine_handle
<PromiseType
>) noexcept
;
17 template <class Promise
> struct coroutine_handle
: coroutine_handle
<void> {
18 coroutine_handle() = default;
19 static coroutine_handle
from_address(void *) noexcept
;
23 struct suspend_always
{
24 bool await_ready() noexcept
;
25 void await_suspend(std::coroutine_handle
<>) noexcept
;
26 void await_resume() noexcept
;
31 task
get_return_object() { return task(); }
32 suspend_always
initial_suspend() { return {}; }
33 suspend_always
final_suspend() noexcept
{ return {}; }
35 void unhandled_exception() {}
40 task
await() { (void)co_await
*this; }
41 bool await_ready() { return false; }
42 bool await_suspend(std::coroutine_handle
<> awaiter
) { return false; }
43 bool await_resume() { return false; }