diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-28 22:54:28 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-28 22:54:28 +0000 |
commit | f23734558fa425e3de1c8475c61115006b458d46 (patch) | |
tree | 9aeeeecfbf46942cca5a5777a38b04d5a15f9351 /clang/test/SemaObjC/arc-type-conversion.m | |
parent | c4d3df529a2b5a6e709e68f5bc060317abf26aa0 (diff) |
[ARC] Do not transfer ARC ownership if the cast is going to result in r-value,
in which case the ownership is redundant. Thanks to John for the suggestion.
Diffstat (limited to 'clang/test/SemaObjC/arc-type-conversion.m')
-rw-r--r-- | clang/test/SemaObjC/arc-type-conversion.m | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/arc-type-conversion.m b/clang/test/SemaObjC/arc-type-conversion.m index c626cedcc5e..78bb180707f 100644 --- a/clang/test/SemaObjC/arc-type-conversion.m +++ b/clang/test/SemaObjC/arc-type-conversion.m @@ -77,4 +77,12 @@ void ownership_transfer_in_cast(void *vp, Block *pblk) { Block_strong blk_strong1; Block_strong blk_strong2 = (Block)blk_strong1; Block_autoreleasing *blk_auto = (Block*)pblk; + + id lv; + (void)(id)&lv; // expected-error {{cast of an indirect pointer to an Objective-C pointer to 'id'}} + (void)(id*)lv; // expected-error {{cast of an Objective-C pointer to '__strong id *'}} + (void)(NSString*)&lv; // expected-error {{cast of an indirect pointer to an Objective-C pointer to 'NSString *'}} + (void)(NSString**)lv; // expected-error {{cast of an Objective-C pointer to 'NSString *__strong *'}} + (void)(Block)&lv; // expected-error {{cast of an indirect pointer to an Objective-C pointer to 'Block'}} + (void)(Block*)lv; // expected-error {{cast of an Objective-C pointer to '__strong Block *'}} } |