87a5ccfb7c
2018-10-29 Joseph Myers <joseph@codesourcery.com> Julian Brown <julian@codesourcery.com> * semantics.c (handle_omp_array_sections_1): Allow array sections with "this" pointer for OpenACC. Co-Authored-By: Julian Brown <julian@codesourcery.com> From-SVN: r265591
44 lines
468 B
C
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;
|
|
}
|