aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-22 05:02:47 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-22 05:02:47 +0000
commitac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa (patch)
tree722f199bf702a2292747f89396b3c066869c3e85 /test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp
parente9ee382c32a83e9807a2fe4cfd52b5a11169a4b8 (diff)
Generate an AST for the conversion from a lambda closure type to a
block pointer that returns a block literal which captures (by copy) the lambda closure itself. Some aspects of the block literal are left unspecified, namely the capture variable (which doesn't actually exist) and the body (which will be filled in by IRgen because it can't be written as an AST). Because we're switching to this model, this patch also eliminates tracking the copy-initialization expression for the block capture of the conversion function, since that information is now embedded in the synthesized block literal. -1 side tables FTW. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151131 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp
deleted file mode 100644
index f6a8db23e9..0000000000
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fblocks %s -verify
-
-void block_capture_errors() {
- __block int var; // expected-note 2{{'var' declared here}}
- (void)[var] { }; // expected-error{{__block variable 'var' cannot be captured in a lambda}}
-
- (void)[=] { var = 17; }; // expected-error{{__block variable 'var' cannot be captured in a lambda}}
-}
-
-void conversion_to_block(int captured) {
- int (^b1)(int) = [=](int x) { return x + captured; };
-
- const auto lambda = [=](int x) { return x + captured; };
- int (^b2)(int) = lambda;
-}
-
-template<typename T>
-class ConstCopyConstructorBoom {
-public:
- ConstCopyConstructorBoom(ConstCopyConstructorBoom&);
-
- ConstCopyConstructorBoom(const ConstCopyConstructorBoom&) {
- T *ptr = 1; // expected-error{{cannot initialize a variable of type 'float *' with an rvalue of type 'int'}}
- }
-
- void foo() const;
-};
-
-void conversion_to_block_init(ConstCopyConstructorBoom<int> boom,
- ConstCopyConstructorBoom<float> boom2) {
- const auto& lambda1([=] { boom.foo(); }); // okay
-
- const auto& lambda2([=] { boom2.foo(); }); // expected-note{{in instantiation of member function}}
- void (^block)(void) = lambda2;
-}
-
-
-void nesting() {
- int array[7]; // expected-note 2{{'array' declared here}}
- [=] () mutable {
- [&] {
- ^ {
- int i = array[2];
- i += array[3];
- }();
- }();
- }();
-
- [&] {
- [=] () mutable {
- ^ {
- int i = array[2]; // expected-error{{cannot refer to declaration with an array type inside block}}
- i += array[3]; // expected-error{{cannot refer to declaration with an array type inside block}}
- }();
- }();
- }();
-}