| 1 |
// PR c++/105839 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-fopenmp" } |
| 4 |
|
| 5 |
template <typename T> |
| 6 |
void |
| 7 |
foo (const T &x) |
| 8 |
{ |
| 9 |
[&] (auto &&y) // { dg-error "use of 'auto' in lambda parameter declaration only available with" "" { target c++11_only } } |
| 10 |
{ |
| 11 |
#pragma omp parallel for |
| 12 |
for (auto &&[v1, v2] : x) // { dg-error "cannot decompose non-array non-class type 'const int'" } |
| 13 |
; // { dg-error "invalid type for iteration variable" "" { target c++14 } .-1 } |
| 14 |
// { dg-warning "structured bindings only available with" "" { target c++14_down } .-2 } |
| 15 |
} ([]{}); // { dg-error "no match for call to" "" { target c++11_only } } |
| 16 |
// { dg-error "invalid user-defined conversion from" "" { target c++11_only } .-1 } |
| 17 |
// { dg-error "invalid conversion from" "" { target c++11_only } .-2 } |
| 18 |
} |
| 19 |
|
| 20 |
void |
| 21 |
bar () |
| 22 |
{ |
| 23 |
int a[10]; |
| 24 |
foo (a); |
| 25 |
} |