| 1 |
// PR c++/85515 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
int a[10]; |
| 5 |
|
| 6 |
void |
| 7 |
foo () |
| 8 |
{ |
| 9 |
for (auto &i : a) |
| 10 |
if (i != *__for_begin // { dg-error "was not declared in this scope" } |
| 11 |
|| &i == __for_end // { dg-error "was not declared in this scope" } |
| 12 |
|| &__for_range[0] != &a[0]) // { dg-error "was not declared in this scope" } |
| 13 |
__builtin_abort (); |
| 14 |
} |
| 15 |
|
| 16 |
template <int N> |
| 17 |
void |
| 18 |
bar () |
| 19 |
{ |
| 20 |
for (auto &i : a) |
| 21 |
if (i != *__for_begin // { dg-error "was not declared in this scope" } |
| 22 |
|| &i == __for_end // { dg-error "was not declared in this scope" } |
| 23 |
|| &__for_range[0] != &a[0]) // { dg-error "was not declared in this scope" } |
| 24 |
__builtin_abort (); |
| 25 |
} |
| 26 |
|
| 27 |
void |
| 28 |
baz () |
| 29 |
{ |
| 30 |
foo (); |
| 31 |
bar <0> (); |
| 32 |
} |