1 | // RUN: %libomptarget-compileoptxx-run-and-check-generic |
2 | |
3 | #include <omp.h> |
4 | #include <stdio.h> |
5 | |
6 | #pragma omp declare target |
7 | class A { |
8 | public: |
9 | constexpr static double pi = 3.141592653589793116; |
10 | A() { ; } |
11 | ~A() { ; } |
12 | }; |
13 | #pragma omp end declare target |
14 | |
15 | #pragma omp declare target |
16 | constexpr static double anotherPi = 3.14; |
17 | #pragma omp end declare target |
18 | |
19 | int main() { |
20 | double a[2]; |
21 | #pragma omp target map(tofrom : a[:2]) |
22 | { |
23 | a[0] = A::pi; |
24 | a[1] = anotherPi; |
25 | } |
26 | |
27 | // CHECK: pi = 3.141592653589793116 |
28 | printf(format: "pi = %.18f\n" , a[0]); |
29 | |
30 | // CHECK: anotherPi = 3.14 |
31 | printf(format: "anotherPi = %.2f\n" , a[1]); |
32 | |
33 | return 0; |
34 | } |
35 | |