OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [property/] [synthesize-9.m] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2
/* { dg-do compile } */
3
 
4
/* Test that when using @synthesize with a readonly property, the
5
   instance variable can be a specialization of the property type.  */
6
 
7
#include <objc/objc.h>
8
 
9
@protocol MyProtocol
10
- (void)aMethod;
11
@end
12
 
13
@interface ClassA
14
@end
15
 
16
@interface ClassB : ClassA
17
@end
18
 
19
 
20
/* This is all OK.  */
21
@interface Test
22
{
23
  int v;
24
  float w;
25
  id x;
26
  Test *y;
27
  id <MyProtocol> *z;
28
  ClassA *a;
29
  ClassB *b;
30
  ClassA <MyProtocol> *c;
31
}
32
@property (assign, readonly) int v;
33
@property (assign, readonly) float w;
34
@property (assign, readonly) id x;
35
@property (assign, readonly) Test *y;
36
@property (assign, readonly) id <MyProtocol> *z;
37
@property (assign, readonly) ClassA *a;
38
@property (assign, readonly) ClassB *b;
39
@end
40
 
41
@implementation Test
42
@synthesize v;
43
@synthesize w;
44
@synthesize x;
45
@synthesize y;
46
@synthesize z;
47
@synthesize a;
48
@synthesize b;
49
@end
50
 
51
 
52
/* This is sometimes OK, sometimes not OK.  */
53
@interface Test2
54
{
55
  int v;                   /* { dg-message "originally specified here" } */
56
  float w;                 /* { dg-message "originally specified here" } */
57
  id x;                    /* { dg-message "originally specified here" } */
58
  Test *y;
59
  id <MyProtocol> *z;      /* { dg-message "originally specified here" } */
60
  ClassA *a;               /* { dg-message "originally specified here" } */
61
  ClassB *b;
62
}
63
@property (assign, readonly) float v;
64
@property (assign, readonly) id w;
65
@property (assign, readonly) int x;
66
@property (assign, readonly) id y;
67
@property (assign, readonly) Test *z;
68
@property (assign, readonly) ClassB *a;
69
@property (assign, readonly) ClassA *b;
70
@end
71
 
72
@implementation Test2
73
@synthesize v; /* { dg-error "property .v. is using instance variable .v. of incompatible type" } */
74
@synthesize w; /* { dg-error "property .w. is using instance variable .w. of incompatible type" } */
75
@synthesize x; /* { dg-error "property .x. is using instance variable .x. of incompatible type" } */
76
@synthesize y;
77
@synthesize z; /* { dg-error "property .z. is using instance variable .z. of incompatible type" } */
78
@synthesize a; /* { dg-error "property .a. is using instance variable .a. of incompatible type" } */
79
@synthesize b;
80
@end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.