aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C
new file mode 100644
index 0000000..49fbdf3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C
@@ -0,0 +1,13 @@
+// FDIS 5.1.2/8
+// { dg-do compile { target c++11 } }
+// { dg-options "-pedantic-errors" }
+
+struct S2 { void f(int i); };
+void S2::f(int i) {
+ [&, i]{ }; // OK
+ [&, &i]{ }; // { dg-error "" } i preceded by & when & is the default
+ [=, i]{ }; // { dg-error "" } i not preceded by & when = is the default
+ [=, this]{ }; // { dg-error "" } this when = is the default
+ [i, i]{ }; // { dg-error "" } i repeated
+ [this, this]{ }; // { dg-error "" } i repeated
+}