35 lines · cpp
1// RUN: %libomptarget-compileoptxx-run-and-check-generic2 3#include <omp.h>4#include <stdio.h>5 6#pragma omp declare target7class A {8public:9 constexpr static double pi = 3.141592653589793116;10 A() { ; }11 ~A() { ; }12};13#pragma omp end declare target14 15#pragma omp declare target16constexpr static double anotherPi = 3.14;17#pragma omp end declare target18 19int 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.14159265358979311628 printf("pi = %.18f\n", a[0]);29 30 // CHECK: anotherPi = 3.1431 printf("anotherPi = %.2f\n", a[1]);32 33 return 0;34}35