1 // RUN: %clang_cc1 -std=c++2b %s -fsyntax-only -verify
3 #include "Inputs/std-coroutine.h"
10 using handle
= std::coroutine_handle
<promise_type
>;
12 promise_type(const promise_type
&) = delete; // #copy-ctr
13 promise_type(T
); // #candidate
14 coro_test
get_return_object();
15 std::suspend_never
initial_suspend();
16 std::suspend_never
final_suspend() noexcept
;
18 void unhandled_exception();
21 template<typename Arg
, typename
... Args
>
22 void* operator new(decltype(0zu
) sz
, Arg
&&, Args
&... args
) {
23 static_assert(!__is_same(__decay(Arg
), S
), "Ok"); // expected-error 2{{Ok}}
32 template <typename Ret
, typename
... P
>
33 struct std::coroutine_traits
<coro_test
<S
&>, Ret
, P
...> {
34 using promise_type
= coro_test
<S
&>::promise_type
;
35 static_assert(!__is_same(Ret
, S
&), "Ok"); // expected-error{{static assertion failed due to requirement '!__is_same(S &, S &)': Ok}}
41 coro_test
<S
&> ok(this S
&, int) {
42 co_return
; // expected-note {{in instantiation}}
45 coro_test
<const S
&> ok2(this const S
&) { // expected-note {{in instantiation}}
49 coro_test
<int> ko(this const S
&) { // expected-error {{no matching constructor for initialization of 'std::coroutine_traits<coro_test<int>, const S &>::promise_type'}} \
50 // expected-note {{in instantiation}} \
51 // FIXME: the message below is unhelpful but this is pre-existing
52 // expected-note@#candidate {{candidate constructor not viable: requires 1 argument, but 0 were provided}} \
53 // expected-note@#copy-ctr {{candidate constructor not viable}}