| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
/* Check that the missing declaration for construct does not trigger an ICE but |
| 4 |
is rejected as invalid code. */ |
| 5 |
|
| 6 |
int *f(); |
| 7 |
|
| 8 |
struct t { |
| 9 |
int *a, *b; |
| 10 |
}; |
| 11 |
|
| 12 |
#pragma omp declare variant(construct) match(construct={dispatch}) adjust_args(need_device_ptr: x,y) /* { dg-error "'construct' undeclared here \\(not in a function\\)" } */ |
| 13 |
#pragma omp declare variant(noconstruct) match(implementation={vendor(gnu)}) /* { dg-error "'noconstruct' undeclared here \\(not in a function\\)" } */ |
| 14 |
void bar(int *x, int *y); |
| 15 |
|
| 16 |
int nocontext, novariant; |
| 17 |
|
| 18 |
void sub(struct t *s, void *y) |
| 19 |
{ |
| 20 |
bar( f(), s->b); |
| 21 |
#pragma omp dispatch device(0) is_device_ptr(s) |
| 22 |
bar( f(), s->b); |
| 23 |
|
| 24 |
bar( (int *) y, s->b); |
| 25 |
#pragma omp dispatch device(0) is_device_ptr(y) |
| 26 |
bar( (int *) y, s->b); |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
|