34 lines · cpp
1// RUN: %libomptarget-compilexx-generic2// RUN: %libomptarget-run-generic3// RUN: %libomptarget-compilexx-generic -DCTOR_KERNEL4// RUN: %not --crash %libomptarget-run-generic5// RUN: %libomptarget-compilexx-generic -DCTOR_API6// RUN: %not --crash %libomptarget-run-generic7 8#include <cstdio>9#include <omp.h>10 11void foo_dev() { __builtin_trap(); }12 13#pragma omp declare variant(foo_dev) match(device = {kind(nohost)})14void foo() {}15 16struct S {17 S() { foo(); }18};19 20S s;21#pragma omp declare target(s)22 23int main() {24 int Dev = omp_get_default_device();25 26#ifdef CTOR_KERNEL27#pragma omp target28 {}29#endif30#ifdef CTOR_API31 omp_get_mapped_ptr(&s, Dev);32#endif33}34