aboutsummaryrefslogtreecommitdiff
path: root/offload/test/offloading/global_constructor.cpp
blob: eb68c5f78358be5f91cc12abab8785c0373cf011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// RUN: %libomptarget-compilexx-generic && %libomptarget-run-generic | %fcheck-generic

#include <cstdio>

int foo() { return 1; }

class C {
public:
  C() : x(foo()) {}

  int x;
};

C c;
#pragma omp declare target(c)

int main() {
  int x = 0;
#pragma omp target map(from : x)
  { x = c.x; }

  // CHECK: PASS
  if (x == 1)
    printf("PASS\n");
}