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-11.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 the error reporting for the dot-syntax in the scenario where
5
   we have a setter, but not a getter, yet a getter is requested.  */
6
 
7
#include 
8
#include 
9
#include 
10
 
11
static int c;
12
 
13
@interface MyRootClass
14
{
15
  Class isa;
16
  int a;
17
}
18
+ (id) initialize;
19
+ (id) alloc;
20
- (id) init;
21
- (void) setCount: (int)count;
22
+ (void) setClassCount: (int)count;
23
@end
24
 
25
@implementation MyRootClass
26
+ (id) initialize { return self; }
27
+ (id) alloc { return class_createInstance (self, 0); }
28
- (id) init { return self; }
29
- (void) setCount: (int)count
30
{
31
  a = count;
32
}
33
+ (void) setClassCount: (int)count
34
{
35
  c = count;
36
}
37
@end
38
 
39
@interface MySubClass : MyRootClass
40
+ (int) testMe;
41
- (int) testMe;
42
@end
43
 
44
@implementation MySubClass
45
- (int) testMe
46
{
47
  super.count = 400;
48
  if (super.count != 400) /* { dg-error "no .count. getter found" } */
49
    abort ();
50
 
51
  return super.count;     /* { dg-error "no .count. getter found" } */
52
}
53
+ (int) testMe
54
{
55
  super.classCount = 4000;
56
  if (super.classCount != 4000) /* { dg-error "no .classCount. getter found" } */
57
    abort ();
58
 
59
  return super.classCount;      /* { dg-error "no .classCount. getter found" } */
60
}
61
@end

powered by: WebSVN 2.1.0

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