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 3 // RUN: diff %t %s.result 4 // DISABLE: mingw32 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]; 16 [[[NSString string] retain] release]; 17 [pool drain]; 18 if (s) 19 [s release]; 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 } 35