projects
/
platform
/
upstream
/
gcc.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
allocate_deferred_char_scalar_1.f03: Fix dg-do syntax.
[platform/upstream/gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp0x
/
lambda
/
lambda-pass.C
1
// { dg-do run }
2
// { dg-options "-std=c++0x" }
3
4
#include <cassert>
5
#include <algorithm>
6
7
template <typename F, typename A1>
8
void call(F f, const A1& arg1) {
9
f(arg1);
10
}
11
12
int main() {
13
int i = 1;
14
call(
15
[&i] (int j) -> void { i = j; },
16
2
17
);
18
assert(i == 2);
19
20
int A[] = {1, 2, 3, 4};
21
int sum = 0;
22
std::for_each(A, A+4, [&sum] (int n) -> void { sum += n; });
23
assert(sum == 10);
24
25
return 0;
26
}
27