[Transforms] Silence a warning in SROA.cpp (NFC)
[llvm-project.git] / offload / test / offloading / target_constexpr_mapping.cpp
blob14cf92a7cc26e060214557a405935a4d99db61e8
1 // RUN: %libomptarget-compileoptxx-run-and-check-generic
3 #include <omp.h>
4 #include <stdio.h>
6 #pragma omp declare target
7 class A {
8 public:
9 constexpr static double pi = 3.141592653589793116;
10 A() { ; }
11 ~A() { ; }
13 #pragma omp end declare target
15 #pragma omp declare target
16 constexpr static double anotherPi = 3.14;
17 #pragma omp end declare target
19 int main() {
20 double a[2];
21 #pragma omp target map(tofrom : a[:2])
23 a[0] = A::pi;
24 a[1] = anotherPi;
27 // CHECK: pi = 3.141592653589793116
28 printf("pi = %.18f\n", a[0]);
30 // CHECK: anotherPi = 3.14
31 printf("anotherPi = %.2f\n", a[1]);
33 return 0;