mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
30 lines
492 B
C++
30 lines
492 B
C++
/*
|
|
* @@name: declare_target.2c
|
|
* @@type: C++
|
|
* @@compilable: no
|
|
* @@linkable: no
|
|
* @@expect: failure
|
|
*/
|
|
struct typeX
|
|
{
|
|
int a;
|
|
};
|
|
class typeY
|
|
{
|
|
int a;
|
|
public:
|
|
int foo() { return a^0x01;}
|
|
};
|
|
#pragma omp declare target
|
|
struct typeX varX; // ok
|
|
class typeY varY; // ok if varY.foo() not called on target device
|
|
#pragma omp end declare target
|
|
void foo()
|
|
{
|
|
#pragma omp target
|
|
{
|
|
varX.a = 100; // ok
|
|
varY.foo(); // error foo() is not available on a target device
|
|
}
|
|
}
|