John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c++ %s.result |
| 2 | // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s > %t |
Argyrios Kyrtzidis | b1094a0 | 2011-06-23 21:21:33 +0000 | [diff] [blame] | 3 | // RUN: diff %t %s.result |
Argyrios Kyrtzidis | d8b4216 | 2012-01-12 02:34:32 +0000 | [diff] [blame] | 4 | // DISABLE: mingw32 |
Argyrios Kyrtzidis | b1094a0 | 2011-06-23 21:21:33 +0000 | [diff] [blame] | 5 | |
| 6 | #include "Common.h" |
| 7 | |
| 8 | @interface NSString : NSObject |
| 9 | +(id)string; |
| 10 | @end |
| 11 | |
| 12 | struct foo { |
| 13 | NSString *s; |
| 14 | foo(NSString *s): s([s retain]){ |
| 15 | NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
Argyrios Kyrtzidis | e0e4076 | 2011-07-14 21:26:49 +0000 | [diff] [blame] | 16 | [[[NSString string] retain] release]; |
Argyrios Kyrtzidis | b1094a0 | 2011-06-23 21:21:33 +0000 | [diff] [blame] | 17 | [pool drain]; |
Argyrios Kyrtzidis | aec230d | 2011-09-01 20:53:18 +0000 | [diff] [blame] | 18 | if (s) |
| 19 | [s release]; |
Argyrios Kyrtzidis | b1094a0 | 2011-06-23 21:21:33 +0000 | [diff] [blame] | 20 | } |
| 21 | ~foo(){ [s release]; } |
| 22 | private: |
| 23 | foo(foo const &); |
| 24 | foo &operator=(foo const &); |
| 25 | }; |
| 26 | |
| 27 | int main(){ |
| 28 | NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
| 29 | |
| 30 | foo f([[NSString string] autorelease]); |
| 31 | |
| 32 | [pool drain]; |
| 33 | return 0; |
| 34 | } |