1/*
2 * Copyright (c) 2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LLVM_LICENSE_HEADER@
5 */
6
7/*  block_prop.m
8    Created by Chris Parker on 29 Sep 2008
9    compiler should warn that block properties require a copy attribute
10*/
11
12// rdar://6379842 warn: 'copy' attribute
13// TEST_CONFIG MEM=gc
14// TEST_CFLAGS -fobjc-gc-only -framework Foundation
15/*
16TEST_BUILD_OUTPUT
17.*block_prop.m:29:(1:)? warning: 'copy' attribute must be specified for the block property( 'someBlock')? when -fobjc-gc-only is specified
18END
19*/
20
21#import <Foundation/Foundation.h>
22#import <Block.h>
23#import "test.h"
24
25@interface Thing : NSObject {
26    void (^someBlock)(void);
27}
28
29@property void(^someBlock)(void);
30
31- (void)emit;
32
33@end
34
35@implementation Thing
36
37@synthesize someBlock;
38
39- (void)emit {
40    someBlock();
41}
42
43- (void)dealloc {
44    if (someBlock) Block_release(someBlock);
45    [super dealloc];
46}
47
48@end
49
50int main () {
51    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
52
53    Thing *t = [Thing new];
54
55    [t setSomeBlock:^{ }];
56    [t emit];
57
58    [t release];
59
60    [pool drain];
61
62    succeed(__FILE__);
63}
64