Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/coroutines/coro-missing-promise-yield.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 #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 } |