summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C
new file mode 100644
index 000000000..74149b231
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C
@@ -0,0 +1,19 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+#include <cassert>
+
+int main() {
+ int i = 1, j = 2;
+ [i, j] () -> void {} ();
+ assert(i == 1);
+ assert(j == 2);
+ [&i, &j] () -> void {} ();
+ assert(i == 1);
+ assert(j == 2);
+ [] (int x) -> void {} (1);
+ [] (int& x) -> void {} (i);
+ [] (int x, int y) -> void {} (i, j);
+
+ return 0;
+}
+