llvm-project
33 строки · 774.0 Байт
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
5#include "Common.h"
6
7@interface NSString : NSObject
8+(id)string;
9@end
10
11struct foo {
12NSString *s;
13foo(NSString *s): s([s retain]){
14NSAutoreleasePool *pool = [NSAutoreleasePool new];
15[[[NSString string] retain] release];
16[pool drain];
17if (s)
18[s release];
19}
20~foo(){ [s release]; }
21private:
22foo(foo const &);
23foo &operator=(foo const &);
24};
25
26int main(){
27NSAutoreleasePool *pool = [NSAutoreleasePool new];
28
29foo f([[NSString string] autorelease]);
30
31[pool drain];
32return 0;
33}
34