summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC/property.m
blob: cf2624f8204d603de34f5e967596ef669e10971d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -verify %s

@interface I 
{
	int IVAR;
	int name;
}
@property int d1;
@property id  prop_id; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}}, expected-warning {{default property attribute 'assign' not appropriate for non-gc object}}
@property int name;
@end

@interface I(CAT)
@property int d1;
@end

@implementation I
@synthesize d1;		// expected-error {{synthesized property 'd1' must either be named the same as}}
@dynamic    bad;	// expected-error {{property implementation must have its declaration in interface 'I'}}
@synthesize prop_id;	// expected-error {{synthesized property 'prop_id' must either be named the same}}  // expected-note {{previous declaration is here}}
@synthesize prop_id = IVAR;	// expected-error {{type of property 'prop_id' does not match type of ivar 'IVAR'}} // expected-error {{property 'prop_id' is already implemented}}
@synthesize name;	// OK! property with same name as an accessible ivar of same name
@end

@implementation I(CAT)  
@synthesize d1;		// expected-error {{@synthesize not allowed in a category's implementation}}
@dynamic bad;		// expected-error {{property implementation must have its declaration in the category 'CAT'}}
@end

@implementation E	// expected-warning {{cannot find interface declaration for 'E'}}
@dynamic d;		// expected-error {{property implementation must have its declaration in interface 'E'}}
@end

@implementation Q(MYCAT)  // expected-error {{cannot find interface declaration for 'Q'}}
@dynamic d;		// expected-error {{property implementation in a category with no category declaration}}
@end

@interface Foo
@property double bar;
@end

int func1() {
   id foo;
   double bar = [foo bar];
   return 0;
}

// PR3932
typedef id BYObjectIdentifier;
@interface Foo1  {
  void *isa;
}
@property(copy) BYObjectIdentifier identifier;
@end

OpenPOWER on IntegriCloud