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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [property/] [dotsyntax-15.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 dot-syntax with accessors to be looked up in protocols.  */
5
 
6
#include 
7
#include 
8
#include 
9
 
10
@protocol ProtocolA
11
- (int) countA;
12
- (void) setCountA: (int)aNumber;
13
@end
14
 
15
@protocol ProtocolB
16
- (int) countB;
17
- (void) setCountB: (int)aNumber;
18
@end
19
 
20
@protocol ProtocolC
21
- (int) countC;
22
- (void) setCountC: (int)aNumber;
23
@end
24
 
25
@interface MyRootClass
26
{
27
  Class isa;
28
}
29
+ (id) initialize;
30
+ (id) alloc;
31
- (id) init;
32
@end
33
 
34
@interface MySubClass 
35
@end
36
 
37
int function (MySubClass *object, int x)
38
{
39
  object.countA = x;
40
  object.countB = x;
41
  object.countC = object.countB;
42
 
43
  return object.countC;
44
}
45
 
46
int function2 (MyRootClass  *object, int x)
47
{
48
  object.countA = x;
49
  object.countB = x;
50
  object.countC = object.countB;
51
 
52
  return object.countC;
53
}
54
 
55
int function3 (MyRootClass  *object, int x)
56
{
57
  object.countA = x;
58
  object.countB = x;
59
  object.countC = object.countB; /* { dg-error "request for member .countC. in" } */
60
 
61
  return object.countC;          /* { dg-error "request for member .countC. in" } */
62
}
63
 
64
int function4 (id  object, int x)
65
{
66
  object.countA = x;
67
  object.countB = x;
68
  object.countC = object.countB;
69
 
70
  return object.countC;
71
}
72
 
73
int function5 (id  object, int x)
74
{
75
  object.countA = x;
76
  object.countB = x;
77
  object.countC = object.countB; /* { dg-error "request for member .countC. in" } */
78
 
79
  return object.countC;          /* { dg-error "request for member .countC. in" } */
80
}

powered by: WebSVN 2.1.0

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