| 1 |
// { dg-skip-if "requires hosted libstdc++ for cassert" { ! hostedlib } } |
| 2 |
|
| 3 |
#include <cassert> |
| 4 |
|
| 5 |
struct S { |
| 6 |
int x[10]; |
| 7 |
}; |
| 8 |
|
| 9 |
S * |
| 10 |
choose (S *a, S *b, int c) |
| 11 |
{ |
| 12 |
if (c < 5) |
| 13 |
return a; |
| 14 |
else |
| 15 |
return b; |
| 16 |
} |
| 17 |
|
| 18 |
int main (int argc, char *argv[]) |
| 19 |
{ |
| 20 |
S a, b; |
| 21 |
|
| 22 |
for (int i = 0; i < 10; i++) |
| 23 |
a.x[i] = b.x[i] = 0; |
| 24 |
|
| 25 |
for (int i = 0; i < 10; i++) |
| 26 |
{ |
| 27 |
#pragma omp target map(choose(&a, &b, i)->x[:10]) |
| 28 |
/* { dg-message {sorry, unimplemented: unsupported map expression 'choose\(\(& a\), \(& b\), i\)->S::x\[0\]'} "" { target *-*-* } .-1 } */ |
| 29 |
for (int j = 0; j < 10; j++) |
| 30 |
choose (&a, &b, i)->x[j]++; |
| 31 |
} |
| 32 |
|
| 33 |
for (int i = 0; i < 10; i++) |
| 34 |
assert (a.x[i] == 5 && b.x[i] == 5); |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |
| 38 |
|
| 39 |
|