aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-10 09:37:05 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-10 09:37:05 +0000
commit93e2fa488740a68604a4069ac61eba398de7275d (patch)
treefb5c6657cb4be3ab8a5b28a80b395e12dacc2b67 /test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
parenta6ce20ea10b1788ed1f266d5809a7ac2bca7bf1b (diff)
Add a lambda example from the working draft.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150239 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
index 8f524e0824..b897d5f10a 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
@@ -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}}
+}