| 1 |
// PR c++/108503 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
// { dg-additional-options "-Wall" } |
| 4 |
|
| 5 |
namespace std { |
| 6 |
template <typename T> struct tuple_size; |
| 7 |
template <int, typename> struct tuple_element; |
| 8 |
} |
| 9 |
struct A { |
| 10 |
template <int I> int get () { return 1; } |
| 11 |
}; |
| 12 |
template <> struct std::tuple_size <A> { static const int value = 3; }; |
| 13 |
template <int I> struct std::tuple_element <I, A> { using type = int; }; |
| 14 |
|
| 15 |
struct B { |
| 16 |
A *begin (); |
| 17 |
A *end (); |
| 18 |
}; |
| 19 |
|
| 20 |
void |
| 21 |
foo (B a) |
| 22 |
{ |
| 23 |
#pragma omp for collapse(2) |
| 24 |
for (auto [i, j, k] : a) |
| 25 |
for (int l = i; l < j; l += k) // { dg-error "initializer expression refers to iteration variable 'i'" } |
| 26 |
; // { dg-error "condition expression refers to iteration variable 'j'" "" { target *-*-* } .-1 } |
| 27 |
} // { dg-error "increment expression refers to iteration variable 'k'" "" { target *-*-* } .-2 } |