Sign in
gnu
/
gcc
/
refs/tags/releases/gcc-4.6.0
/
.
/
gcc
/
testsuite
/
g++.dg
/
cpp0x
/
range-for1.C
blob: 49e2ecd0bde65d589c1a84b8ba2bfc40ec48fc61 [
file
] [
log
] [
blame
]
// Test for range-based for loop
// Test the loop with an array
// { dg-do run }
// { dg-options "-std=c++0x" }
extern
"C"
void
abort
();
int
main
()
{
int
a
[]
=
{
1
,
2
,
3
,
4
};
int
sum
=
0
;
for
(
int
x
:
a
)
sum
+=
x
;
if
(
sum
!=
10
)
abort
();
}