145
|
1 // { dg-additional-options "-fsyntax-only -w" }
|
|
2 #include "coro.h"
|
|
3
|
|
4 struct MissingPromiseYield {
|
|
5 coro::coroutine_handle<> handle;
|
|
6 MissingPromiseYield () : handle (nullptr) {}
|
|
7 MissingPromiseYield (coro::coroutine_handle<> handle) : handle (handle) {}
|
|
8 struct missing_yield {
|
|
9 coro::suspend_never initial_suspend() { return {}; }
|
|
10 coro::suspend_never final_suspend() { return {}; }
|
|
11 MissingPromiseYield get_return_object() {
|
|
12 return MissingPromiseYield (coro::coroutine_handle<missing_yield>::from_promise (*this));
|
|
13 }
|
|
14 void return_value (int v) {}
|
|
15 void unhandled_exception() { /*std::terminate();*/ };
|
|
16 };
|
|
17 };
|
|
18
|
|
19 template<> struct coro::coroutine_traits<MissingPromiseYield> {
|
|
20 using promise_type = MissingPromiseYield::missing_yield;
|
|
21 };
|
|
22
|
|
23 MissingPromiseYield
|
|
24 bar ()
|
|
25 {
|
|
26 co_yield 22; // { dg-error {no member named 'yield_value' in} }
|
|
27 co_return 0;
|
|
28 }
|
|
29
|
|
30 int main (int ac, char *av[]) {
|
|
31 MissingPromiseYield x = bar ();
|
|
32 return 0;
|
|
33 }
|