summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C
new file mode 100644
index 000000000..b6489de4b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C
@@ -0,0 +1,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;
+}
+