aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
index e99130fcd6..678fa4b964 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
@@ -8,11 +8,18 @@ public:
void foo() const;
};
-void capture_by_copy(NonCopyable nc, NonCopyable &ncr) {
+class NonConstCopy {
+public:
+ NonConstCopy(NonConstCopy&); // expected-note{{would lose const}}
+};
+
+void capture_by_copy(NonCopyable nc, NonCopyable &ncr, const NonConstCopy nco) {
(void)[nc] { }; // expected-error{{capture of variable 'nc' as type 'NonCopyable' calls private copy constructor}}
(void)[=] {
ncr.foo(); // expected-error{{capture of variable 'ncr' as type 'NonCopyable' calls private copy constructor}}
}();
+
+ [nco] {}(); // expected-error{{no matching constructor for initialization of 'const NonConstCopy'}}
}
struct NonTrivial {