1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c++ %s.result 2// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c++ %s > %t 3// RUN: diff %t %s.result 4 5#include "Common.h" 6 7@interface NSString : NSObject 8+(id)string; 9@end 10 11struct foo { 12 NSString *s; 13 foo(NSString *s): s([s retain]){ 14 NSAutoreleasePool *pool = [NSAutoreleasePool new]; 15 [[[NSString string] retain] release]; 16 [pool drain]; 17 } 18 ~foo(){ [s release]; } 19private: 20 foo(foo const &); 21 foo &operator=(foo const &); 22}; 23 24int main(){ 25 NSAutoreleasePool *pool = [NSAutoreleasePool new]; 26 27 foo f([[NSString string] autorelease]); 28 29 [pool drain]; 30 return 0; 31} 32