gcc/testsuite/g++.dg/pr85515-2.C
raw| 1 | // { dg-require-effective-target c++11 } |
| 2 | |
| 3 | void test_1 () |
| 4 | { |
| 5 | int arr[] = {1, 2, 3, 4, 5}; |
| 6 | for (const auto v: arr) { |
| 7 | _forbegin; // { dg-bogus "suggested alternative" } |
| 8 | // { dg-error "'_forbegin' was not declared in this scope" "" { target *-*-*} .-1 } |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | int test_2 () |
| 13 | { |
| 14 | int arr[] = {1, 2, 3, 4, 5}; |
| 15 | int sum = 0; |
| 16 | for (const auto v: arr) { |
| 17 | sum += v; |
| 18 | __for_begin = __for_end; // { dg-error "was not declared in this scope" } |
| 19 | } |
| 20 | return sum; |
| 21 | } |