1 // RUN: %clang_cc1 -x objective-c++ -fblocks -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 %s -verify -std=c++11 -emit-llvm -o %t
9 void f(int (^bl)(B* b));
10 void takeBlock(void (^block)());
15 f(^(A* a) { return 0; });
20 int (^bl)(B* b) = ^(A* a) { return 0; };
26 void bar(id(^)(void));
28 void foo(id <NSObject>(^objectCreationBlock)(void)) {
29 return bar(objectCreationBlock);
44 struct Nested { Nested *ptr = this; };
49 // Regression test for PR13314
53 ^() { // expected-warning {{expression result unused}}
59 [=]() { // expected-warning {{expression result unused}}
65 class CaptureThisAndAnotherPointer {
66 void test(void *ptr) {
67 takeBlock(^{ useValues(ptr, this); });
71 // Check that we don't crash when using BLOCK_LAYOUT_STRONG.
72 #pragma clang assume_nonnull begin
73 @interface NSUUID @end
74 #pragma clang assume_nonnull end
76 struct Wrapper1 { NSUUID *Ref; };
77 struct Wrapper2 { Wrapper1 W1; };
80 - (void) captureStrongRef {