summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/property/dynamic-3.m
blob: e8a6693b04e8f7999c4b437f7adb74fea088dca9 (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
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
/* { dg-do compile } */

#include <objc/objc.h>

@interface MyRootClass
{
  Class isa;
}
@end

@implementation MyRootClass
@end

/* Test @property/@dynamic in a category.  First, a case where
   @dynamic should turn off all warnings.  */

@interface MyRootClass (Category)
@property int a;
- (int) test;
@end
@implementation MyRootClass (Category)
@dynamic a;
- (int) test
{
  return self.a; /* This should compile into [self a] with no warnings.  */
}
@end



/* Test @property/@dynamic in a category.  Second, a case with a
   missing setter and no @dynamic.  A warning should be generated.  */

@interface MyRootClass (Category2)
@property int b;
- (int) test;
@end
@implementation MyRootClass (Category2)
- (int) b
{
  return 0;
}
- (int) test
{
  return self.b;
}
@end /* { dg-warning "incomplete implementation" } */
/* { dg-warning "method definition for .-setB:. not found" "" { target *-*-* } 48 } */