]> granicus.if.org Git - clang/commitdiff
Add a lambda example from the working draft.
authorDouglas Gregor <dgregor@apple.com>
Fri, 10 Feb 2012 09:37:05 +0000 (09:37 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 10 Feb 2012 09:37:05 +0000 (09:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150239 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp

index 8f524e08245a1217c0ce9c4dc73ee35ae639d4b7..b897d5f10a3e5da95b438361ad060eb9d8c7e1e0 100644 (file)
@@ -14,3 +14,12 @@ class X0 {
     (void)[&, this] () {};
   }
 };
+
+struct S2 { void f(int i); };
+
+void S2::f(int i) {
+  (void)[&, i]{ };
+  (void)[&, &i]{ }; // expected-error{{'&' cannot precede a capture when the capture default is '&'}}
+  (void)[=, this]{ }; // expected-error{{'this' cannot appear in a capture list when the capture default is '='}}
+  (void)[i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
+}