comparison gcc/testsuite/g++.dg/coroutines/torture/lambda-00-co-ret.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-do run }
2
3 // Simplest lambda
4
5 #include "../coro.h"
6
7 // boiler-plate for tests of codegen
8 #include "../coro1-ret-int-yield-int.h"
9
10 int main ()
11 {
12 auto f = []() -> coro1
13 {
14 PRINT ("coro1: about to return");
15 co_return 42;
16 };
17
18 PRINT ("main: create coro1");
19 coro1 x = f ();
20 PRINT ("main: got coro1 - resuming");
21 if (x.handle.done())
22 abort();
23 x.handle.resume();
24 PRINT ("main: after resume");
25 int y = x.handle.promise().get_value();
26 if ( y != 42 )
27 abort ();
28 if (!x.handle.done())
29 {
30 PRINT ("main: apparently not done...");
31 abort ();
32 }
33 PRINT ("main: returning");
34 return 0;
35 }