summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C
blob: 9c2b1195af30d21118f66f66192286ebd045c1ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// { dg-do "run" }
// { dg-options "-std=c++0x" }

#include <cassert>

template<typename F>
void call(F f) { f(); }

int main() {
  call([] () -> void {});
  call([] () mutable -> void {});

  int i = -1;
  call([i] () mutable -> void { i = 0; });
  assert(i == -1);

  return 0;
}