libgomp/testsuite/libgomp.c++/declare-target-indirect-1.C
raw| 1 | // { dg-do run } |
| 2 | |
| 3 | #pragma omp begin declare target indirect |
| 4 | class C |
| 5 | { |
| 6 | public: |
| 7 | int y; |
| 8 | int f (int x) { return x + y; } |
| 9 | }; |
| 10 | #pragma omp end declare target |
| 11 | |
| 12 | int main (void) |
| 13 | { |
| 14 | C c; |
| 15 | c.y = 27; |
| 16 | int x; |
| 17 | int (C::*fn_ptr) (int) = &C::f; |
| 18 | |
| 19 | #pragma omp target map (to: c, fn_ptr) map (from: x) |
| 20 | x = (c.*fn_ptr) (42); |
| 21 | |
| 22 | return x != 27 + 42; |
| 23 | } |