blob: 40802a0b95cf37057a2ae27e563838b75432fd0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// { dg-do compile { target c++17 } }
namespace std {
template<typename T> struct tuple_size;
template<int, typename> struct tuple_element;
}
struct A {
int i;
template <int I> int& get() { return i; }
};
template<> struct std::tuple_size<A> { static const int value = 3; };
template<int I> struct std::tuple_element<I,A> { using type = int; };
struct B {
A *begin();
A *end();
};
void
f1 (B a)
{
#pragma omp for collapse (2)
for (auto [i, j, k] : a) // { dg-error "initializer expression refers to iteration variable 'i'" "" { target *-*-* } .+1 }
for (int l = i; l < j; l += k) // { dg-error "condition expression refers to iteration variable 'j'" }
; // { dg-error "increment expression refers to iteration variable 'k'" "" { target *-*-* } .-1 }
}
template <int N>
void
f2 (B a)
{
#pragma omp for collapse (2)
for (auto [i, j, k] : a) // { dg-error "initializer expression refers to iteration variable 'i'" "" { target *-*-* } .-1 }
for (int l = i; l < j; l += k) // { dg-error "condition expression refers to iteration variable 'j'" }
; // { dg-error "increment expression refers to iteration variable 'k'" "" { target *-*-* } .-3 }
}
template <typename T>
void
f3 (T a)
{
#pragma omp for collapse (2)
for (auto [i, j, k] : a) // { dg-error "initializer expression refers to iteration variable 'i'" "" { target *-*-* } .-1 }
for (int l = i; l < j; l += k) // { dg-error "condition expression refers to iteration variable 'j'" }
; // { dg-error "increment expression refers to iteration variable 'k'" "" { target *-*-* } .-3 }
}
void
test ()
{
B b;
f1 (b);
f2 <0> (b);
f3 <B> (b);
}
|