| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-original" } */ |
| 3 |
|
| 4 |
/* Check that templates are properly handled. */ |
| 5 |
|
| 6 |
template<typename T> |
| 7 |
T templ_var_fn(T x); |
| 8 |
|
| 9 |
#pragma omp declare variant(templ_var_fn) match(construct={dispatch}) adjust_args(need_device_ptr: x) |
| 10 |
template<typename T> |
| 11 |
T templ_base_fn(T x); |
| 12 |
|
| 13 |
template<typename T, typename TB> |
| 14 |
void f(int *y, TB x) |
| 15 |
{ |
| 16 |
#pragma omp dispatch nocontext (x) |
| 17 |
y = templ_base_fn<T> (y); |
| 18 |
#pragma omp dispatch novariants (x) |
| 19 |
y = templ_base_fn<T> (y); |
| 20 |
} |
| 21 |
|
| 22 |
void bar() |
| 23 |
{ |
| 24 |
int a; |
| 25 |
bool b = true; |
| 26 |
f<int*,bool> (&a, b); |
| 27 |
} |
| 28 |
|
| 29 |
/* { dg-final { scan-tree-dump-times "y = \.GOMP_DISPATCH \\(templ_base_fn<int\\*> \\(y\\)\\)" 2 "original" } } */ |