| 1 |
// Test for range-based for loop |
| 2 |
// Test the loop with an array |
| 3 |
|
| 4 |
// { dg-do run { target c++11 } } |
| 5 |
|
| 6 |
extern "C" void abort(); |
| 7 |
|
| 8 |
int main() |
| 9 |
{ |
| 10 |
int a[] = {1,2,3,4}; |
| 11 |
int sum = 0; |
| 12 |
for (int x : a) |
| 13 |
sum += x; |
| 14 |
if (sum != 10) |
| 15 |
abort(); |
| 16 |
} |