aboutsummaryrefslogtreecommitdiff
path: root/offload/test/offloading/ctor_dtor.cpp
blob: 7f08798dea103b32617f4e7c61984a4c6c99e67b (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
// RUN: %libomptarget-compilexx-run-and-check-generic
// RUN: %libomptarget-compileoptxx-run-and-check-generic

#include <cstdio>
struct S {
  S() : i(7) {}
  ~S() { foo(); }
  int foo() { return i; }

private:
  int i;
};

S s;
#pragma omp declare target(s)

int main() {
  int r;
#pragma omp target map(from : r)
  r = s.foo();

  // CHECK: 7
  printf("%i\n", r);
}