1 // PR c++/63249
2 // { dg-do compile }
3 // { dg-options "-Wall -W -fopenmp" }
4
5 template <int N>
6 int
foo(int * v,int A,int B)7 foo (int *v, int A, int B) // { dg-bogus "set but not used" }
8 {
9 int r = 0;
10 int a = 2; // { dg-bogus "set but not used" }
11 int b = 4; // { dg-bogus "set but not used" }
12 #pragma omp target map(to: v[a:b])
13 r |= v[3];
14 #pragma omp target map(to: v[A:B])
15 r |= v[3];
16 return r;
17 }
18
19 template <typename T>
20 int
bar(T * v,T A,T B)21 bar (T *v, T A, T B) // { dg-bogus "set but not used" }
22 {
23 T r = 0, a = 2, b = 4; // { dg-bogus "set but not used" }
24 #pragma omp target map(to: v[a:b])
25 r |= v[3];
26 #pragma omp target map(to: v[A:B])
27 r |= v[3];
28 return r;
29 }
30
31 int
baz(int * v,int A,int B)32 baz (int *v, int A, int B)
33 {
34 return foo<0> (v, A, B) + bar (v, A, B);
35 }
36