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