diff options
Diffstat (limited to 'test/CodeGenObjCXX/blocks.mm')
-rw-r--r-- | test/CodeGenObjCXX/blocks.mm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/CodeGenObjCXX/blocks.mm b/test/CodeGenObjCXX/blocks.mm index 62ae428..63a1b33 100644 --- a/test/CodeGenObjCXX/blocks.mm +++ b/test/CodeGenObjCXX/blocks.mm @@ -8,6 +8,8 @@ @end void f(int (^bl)(B* b)); +void takeBlock(void (^block)()); +void useValues(...); // Test1 void g() { @@ -59,3 +61,25 @@ void gun() { return foovar; }; } + +// PR24780 +class CaptureThisAndAnotherPointer { + void test(void *ptr) { + takeBlock(^{ useValues(ptr, this); }); + } +}; + +// rdar://problem/23713871 +// Check that we don't crash when using BLOCK_LAYOUT_STRONG. +#pragma clang assume_nonnull begin +@interface NSUUID @end +#pragma clang assume_nonnull end + +struct Wrapper1 { NSUUID *Ref; }; +struct Wrapper2 { Wrapper1 W1; }; + +@implementation B +- (void) captureStrongRef { + __block Wrapper2 W2; +} +@end |