3 // Check that we can use co_await as a call parm.
7 // boiler-plate for tests of codegen
8 #define USE_AWAIT_TRANSFORM
9 #include "../coro1-ret-int-yield-int.h"
13 __attribute__((__noinline__))
20 /* Function with a single await. */
24 gX = foo (co_await 9);
30 PRINT ("main: create coro1");
31 struct coro1 f_coro = f ();
33 PRINT ("main: got coro1 - checking gX");
36 PRINTF ("main: gX is wrong : %d, should be 1\n", gX);
40 if (f_coro.handle.done())
42 PRINT ("main: we should not be 'done' [1]");
46 PRINT ("main: resuming [1] (initial suspend)");
47 f_coro.handle.resume();
48 PRINT ("main: resuming [2] (await 9 parm)");
49 f_coro.handle.resume();
53 PRINTF ("main: gX is wrong : %d, should be 11\n", gX);
57 /* we should now have returned with the co_return 11 + 31) */
58 if (!f_coro.handle.done())
60 PRINT ("main: we should be 'done'");
64 int y = f_coro.handle.promise().get_value();
67 PRINTF ("main: y is wrong : %d, should be 42\n", y);