3 // Check foo (compiler temp, co_await).
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 compiler temporary and a co_await. */
24 gX = bar (gX + 8, co_await 2);
30 PRINT ("main: create coro1");
31 struct coro1 g_coro = g ();
32 PRINT ("main: got coro1 - checking gX");
35 PRINTF ("main: gX is wrong : %d, should be 1\n", gX);
38 if (g_coro.handle.done())
40 PRINT ("main: we should not be 'done' [1]");
44 PRINT ("main: resuming [1] (initial suspend)");
45 g_coro.handle.resume();
47 PRINT ("main: resuming [2] (parm 1)");
48 g_coro.handle.resume();
52 PRINTF ("main: gX is wrong : %d, should be 11\n", gX);
56 /* we should now have returned with the co_return 11 + 31) */
57 if (!g_coro.handle.done())
59 PRINT ("main: we should be 'done'");
63 int y = g_coro.handle.promise().get_value();
66 PRINTF ("main: y is wrong : %d, should be 42\n", y);