repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Implement range-based for-statements.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp0x
/
range-for1.C
blob
49e2ecd0bde65d589c1a84b8ba2bfc40ec48fc61
1
// Test for range-based for loop
2
// Test the loop with an array
3
4
// { dg-do run }
5
// { dg-options "-std=c++0x" }
6
7
extern "C" void abort();
8
9
int main()
10
{
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();
17
}