c++: Add new test [PR88092]
[gcc.git] / libgomp / testsuite / libgomp.oacc-c++ / this.C
1 #include <cstdlib>
2 #include <iostream>
3 using namespace std;
4
5 class test {
6 public:
7 int a;
8
9 test ()
10 {
11 a = -1;
12 #pragma acc enter data copyin (this[0:1])
13 }
14
15 ~test ()
16 {
17 #pragma acc exit data delete (this[0:1])
18 }
19
20 void set (int i)
21 {
22 a = i;
23 #pragma acc update device (this[0:1])
24 }
25
26 int get ()
27 {
28 #pragma acc update host (this[0:1])
29 return a;
30 }
31 };
32
33 int
34 main ()
35 {
36 test t;
37
38 t.set (4);
39 if (t.get () != 4)
40 abort ();
41
42 return 0;
43 }