summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-09 00:47:04 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-09 00:47:04 +0000
commit8c50e7c5e380d93f784582579c3e3f1bc157bf12 (patch)
treed6556ee13f1264af6738a39fd7c043365bfeb166 /clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
parentf542675ae34943a85ffcdb9d07c69b181c3d869f (diff)
downloadbcm5719-llvm-8c50e7c5e380d93f784582579c3e3f1bc157bf12.tar.gz
bcm5719-llvm-8c50e7c5e380d93f784582579c3e3f1bc157bf12.zip
Various interrelated cleanups for lambdas:
- Complete the lambda class when we finish the lambda expression (previously, it was left in the "being completed" state) - Actually return the LambdaExpr object and bind to the resulting temporary when needed. - Detect when cleanups are needed while capturing a variable into a lambda (e.g., due to default arguments in the copy constructor), and make sure those cleanups apply for the whole of the lambda expression. llvm-svn: 150123
Diffstat (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
index 0bbb9ae7440..4c876d7480d 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
@@ -6,10 +6,26 @@ class NonCopyable {
void capture_by_copy(NonCopyable nc, NonCopyable &ncr) {
// FIXME: error messages should talk about capture
- [nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \
+ (void)[nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \
// expected-error{{lambda expressions are not supported yet}}
- [ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \
+ (void)[ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \
// expected-error{{lambda expressions are not supported yet}}
}
+struct NonTrivial {
+ NonTrivial();
+ NonTrivial(const NonTrivial &);
+ ~NonTrivial();
+};
+
+struct CopyCtorDefault {
+ CopyCtorDefault(const CopyCtorDefault&, NonTrivial nt = NonTrivial());
+
+ void foo() const;
+};
+
+void capture_with_default_args(CopyCtorDefault cct) {
+ (void)[=] () -> void { cct.foo(); }; // expected-error{{lambda expressions are not supported yet}}
+}
+
// FIXME: arrays!
OpenPOWER on IntegriCloud