comparison gcc/testsuite/g++.dg/coroutines/torture/alloc-04-overload-del-use-two-args.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 /* check that we use the deallocation function with two args when both
4 are available. */
5
6 #define PROVIDE_NEW_SZT
7 #define PROVIDE_DEL_VP
8 #define PROVIDE_DEL_VP_SZT
9
10 #include "../coro1-allocators.h"
11
12 int used_ovl_new = 0;
13 int used_ovl_del = 0;
14 int used_ovl_del_2arg = 0;
15
16 struct coro1
17 f (int v) noexcept
18 {
19 PRINT ("coro1: about to return");
20 co_return;
21 }
22
23 int main ()
24 {
25 // Nest a scope so that we can inspect the flags after the DTORs run.
26 {
27 PRINT ("main: create coro1");
28 struct coro1 x = f (5);
29
30 if (used_ovl_new != 1)
31 {
32 PRINT ("main: apparently used the wrong op new...");
33 abort ();
34 }
35
36 PRINT ("main: got coro1 - resuming");
37 if (x.handle.done())
38 abort();
39 x.handle.resume();
40 PRINT ("main: after resume");
41 if (!x.handle.done())
42 {
43 PRINT ("main: apparently not done...");
44 abort ();
45 }
46 }
47 if (used_ovl_del != 0)
48 {
49 PRINT ("main: wrong call to overloaded operator delete 1 arg");
50 abort ();
51 }
52
53 if (used_ovl_del_2arg != 1)
54 {
55 PRINT ("main: failed to call overloaded operator delete 2 args");
56 abort ();
57 }
58 PRINT ("main: returning");
59 return 0;
60 }