summaryrefslogtreecommitdiff
path: root/offload/test/offloading/ctor_dtor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'offload/test/offloading/ctor_dtor.cpp')
-rw-r--r--offload/test/offloading/ctor_dtor.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/offload/test/offloading/ctor_dtor.cpp b/offload/test/offloading/ctor_dtor.cpp
new file mode 100644
index 000000000000..7f08798dea10
--- /dev/null
+++ b/offload/test/offloading/ctor_dtor.cpp
@@ -0,0 +1,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);
+}