summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/blocks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/blocks.cpp')
-rw-r--r--test/SemaCXX/blocks.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/test/SemaCXX/blocks.cpp b/test/SemaCXX/blocks.cpp
index 3f81c27..a2672d1 100644
--- a/test/SemaCXX/blocks.cpp
+++ b/test/SemaCXX/blocks.cpp
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
-// expected-no-diagnostics
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -fblocks
void tovoid(void*);
@@ -69,3 +68,35 @@ namespace radar8382559 {
return hasProperty = 1;
}
}
+
+// Move __block variables to the heap when possible.
+class MoveOnly {
+public:
+ MoveOnly();
+ MoveOnly(const MoveOnly&) = delete;
+ MoveOnly(MoveOnly&&);
+};
+
+void move_block() {
+ __block MoveOnly mo;
+}
+
+// Don't crash after failing to build a block due to a capture of an
+// invalid declaration.
+namespace test5 {
+ struct B { // expected-note 2 {{candidate constructor}}
+ void *p;
+ B(int); // expected-note {{candidate constructor}}
+ };
+
+ void use_block(void (^)());
+ void use_block_2(void (^)(), const B &a);
+
+ void test() {
+ B x; // expected-error {{no matching constructor for initialization}}
+ use_block(^{
+ int y;
+ use_block_2(^{ (void) y; }, x);
+ });
+ }
+}
OpenPOWER on IntegriCloud