Implement range-based for-statements.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / range-for1.C
blob49e2ecd0bde65d589c1a84b8ba2bfc40ec48fc61
1 // Test for range-based for loop
2 // Test the loop with an array
4 // { dg-do run }
5 // { dg-options "-std=c++0x" }
7 extern "C" void abort();
9 int main()
11     int a[] = {1,2,3,4};
12     int sum = 0;
13     for (int x : a)
14         sum += x;
15     if (sum != 10)
16         abort();