Retro68/gcc/libgomp/testsuite/libgomp.oacc-c++/this.C
Wolfgang Thaller 6fbf4226da gcc-9.1
2019-06-20 20:10:10 +02:00

44 lines
468 B
C

#include <cstdlib>
#include <iostream>
using namespace std;
class test {
public:
int a;
test ()
{
a = -1;
#pragma acc enter data copyin (this[0:1])
}
~test ()
{
#pragma acc exit data delete (this[0:1])
}
void set (int i)
{
a = i;
#pragma acc update device (this[0:1])
}
int get ()
{
#pragma acc update host (this[0:1])
return a;
}
};
int
main ()
{
test t;
t.set (4);
if (t.get () != 4)
abort ();
return 0;
}