blob: 2c4571be4555668b54f2d00d1f2eb00ec7f92fcf (
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
26
27
28
29
30
31
32
33
34
35
36
|
/* Testing 'has_device_addr' clause on the target construct with template. */
template <typename T>
void
foo (T x)
{
x = 24;
#pragma omp target data map(x) use_device_addr(x)
#pragma omp target has_device_addr(x)
x = 42;
if (x != 42)
__builtin_abort ();
}
template <typename T>
void
bar (T (&x)[])
{
x[0] = 24;
#pragma omp target data map(x[:2]) use_device_addr(x)
#pragma omp target has_device_addr(x[:2])
x[0] = 42;
if (x[0] != 42)
__builtin_abort ();
}
int
main ()
{
int a[] = { 24, 42};
foo <int> (42);
bar <int> (a);
return 0;
}
|