Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/coroutines/coro-missing-ret-void.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
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 } |