3 /* The simplest valued co_await we can do. */
7 // boiler-plate for tests of codegen
8 #include "../coro1-ret-int-yield-int.h"
15 gX = co_await coro1::suspend_always_intprt{};
21 PRINT ("main: create coro1");
22 struct coro1 f_coro = f ();
23 PRINT ("main: got coro1 - checking gX");
26 PRINTF ("main: gX is wrong : %d, should be 1\n", gX);
29 if (f_coro.handle.done())
31 PRINT ("main: we should not be 'done' [1]");
34 PRINT ("main: resuming [1] initial suspend");
35 f_coro.handle.resume();
36 PRINT ("main: resuming [2] co_await suspend_always_intprt");
37 f_coro.handle.resume();
40 PRINTF ("main: gX is wrong : %d, should be 5\n", gX);
43 /* we should now have returned with the co_return (15) */
44 if (!f_coro.handle.done())
46 PRINT ("main: we should be 'done' ");
49 int y = f_coro.handle.promise().get_value();
52 PRINTF ("main: y is wrong : %d, should be 15\n", y);