1 // PR c++/66571
2 // { dg-do compile }
3 // { dg-options "-fopenmp" }
4 
5 template <typename T, typename U>
6 extern void bar (T, T, U);
7 
8 template <typename T, typename U>
9 void
foo(T a,T b,U c)10 foo (T a, T b, U c)
11 {
12   #pragma omp parallel for simd shared (a, c) reduction (+:b)
13   for (int i = 0; i < 10; i++)
14     bar<T> (a, b, c);
15   #pragma omp target map(tofrom:a, c[0:5])
16     ;
17   #pragma omp task depend(inout:c[4:2])
18     ;
19   T d = a;
20   T e = b;
21   U f = c;
22   #pragma omp parallel for simd shared (d, f) reduction (+:e)
23   for (int i = 0; i < 10; i++)
24     bar<T> (d, e, f);
25   #pragma omp target map(tofrom:d, f[0:5])
26     ;
27   #pragma omp task depend(inout:f[4:2])
28     ;
29 }
30 
31 void
baz()32 baz ()
33 {
34   int a = 0, b = 0, cb[10] = {}, *c = cb;
35   foo <int, int *> (a, b, c);
36   foo <int &, int *&> (a, b, c);
37 }
38