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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [property/] [synthesize-8.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Contributed by Nicola Pero , November 2010.  */
2
/* { dg-do compile } */
3
 
4
/* Test that when using @synthesize the instance variable and the
5
   property have exactly the same type.  */
6
 
7
#include 
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  *z;
28
  ClassA *a;
29
  ClassB *b;
30
  ClassA  *c;
31
}
32
@property (assign) int v;
33
@property (assign) float w;
34
@property (assign) id x;
35
@property (assign) Test *y;
36
@property (assign) id  *z;
37
@property (assign) ClassA *a;
38
@property (assign) 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 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;                 /* { dg-message "originally specified here" } */
59
  id  *z;      /* { dg-message "originally specified here" } */
60
  ClassA *a;               /* { dg-message "originally specified here" } */
61
  ClassB *b;               /* { dg-message "originally specified here" } */
62
}
63
@property (assign) float v;
64
@property (assign) id w;
65
@property (assign) int x;
66
@property (assign) id y;
67
@property (assign) Test *z;
68
@property (assign) ClassB *a;
69
@property (assign) 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; /* { dg-error "property .y. is using instance variable .y. of incompatible type" } */
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; /* { dg-error "property .b. is using instance variable .b. of incompatible type" } */
80
@end

powered by: WebSVN 2.1.0

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