| 1 |
// { dg-do compile } |
| 2 |
|
| 3 |
template<typename T> |
| 4 |
struct St { |
| 5 |
T *ptr; |
| 6 |
}; |
| 7 |
|
| 8 |
template<typename T> |
| 9 |
void foo() |
| 10 |
{ |
| 11 |
T arr[20]; |
| 12 |
|
| 13 |
// Reject array section in compound initialiser. |
| 14 |
#pragma omp target map( (struct St<T>) { .ptr = (T *) arr[5:5] } ) |
| 15 |
// { dg-error {expected '\]' before ':' token} "" { target *-*-* } .-1 } |
| 16 |
// { dg-error {expected primary-expression before 'struct'} "" { target *-*-* } .-2 } |
| 17 |
// { dg-error {expected '\)' before 'struct'} "" { target *-*-* } .-3 } |
| 18 |
{ } |
| 19 |
|
| 20 |
// ...and this is unsupported too (probably not useful anyway). |
| 21 |
#pragma omp target map( (struct St<T>) { .ptr = &arr[5] } ) |
| 22 |
// { dg-message {sorry, unimplemented: unsupported map expression 'St<int>\{\(\& arr\[5\]\)\}'} "" { target *-*-* } .-1 } |
| 23 |
{ } |
| 24 |
} |
| 25 |
|
| 26 |
struct S { |
| 27 |
int *ptr; |
| 28 |
}; |
| 29 |
|
| 30 |
int main() |
| 31 |
{ |
| 32 |
int arr[20]; |
| 33 |
|
| 34 |
// Reject array section in compound initialiser. |
| 35 |
#pragma omp target map( (struct S) { .ptr = (int *) arr[5:5] } ) |
| 36 |
// { dg-error {expected '\]' before ':' token} "" { target *-*-* } .-1 } |
| 37 |
// { dg-warning {cast to pointer from integer of different size} "" { target lp64 } .-2 } |
| 38 |
// { dg-error {expected primary-expression before 'struct'} "" { target *-*-* } .-3 } |
| 39 |
// { dg-error {expected '\)' before 'struct'} "" { target *-*-* } .-4 } |
| 40 |
{ } |
| 41 |
|
| 42 |
// ...and this is unsupported too (probably not useful anyway). |
| 43 |
#pragma omp target map( (struct S) { .ptr = &arr[5] } ) |
| 44 |
// { dg-message {sorry, unimplemented: unsupported map expression 'S\{\(\& arr\[5\]\)\}'} "" { target *-*-* } .-1 } |
| 45 |
{ } |
| 46 |
|
| 47 |
foo<int> (); |
| 48 |
|
| 49 |
return 0; |
| 50 |
} |