]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/objc.dg/property/dotsyntax-8.m
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / objc.dg / property / dotsyntax-8.m
CommitLineData
a9625a91
NP
1/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2/* { dg-do run } */
3/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
5/* Test the 'dot syntax' with typedefs. */
6
7#include <stdlib.h>
8#include <objc/objc.h>
9#include <objc/runtime.h>
10
11static int c;
12
13@interface MyRootClass
14{
15 Class isa;
16 int a;
17}
18+ (id) initialize;
19+ (id) alloc;
20- (id) init;
21- (int) count;
22- (void) setCount: (int)count;
23+ (int) classCount;
24+ (void) setClassCount: (int)count;
25@end
26
27@implementation MyRootClass
28+ (id) initialize { return self; }
29+ (id) alloc { return class_createInstance (self, 0); }
30- (id) init { return self; }
31- (int) count
32{
33 return a;
34}
35- (void) setCount: (int)count
36{
37 a = count;
38}
39+ (int) classCount
40{
41 return c;
42}
43+ (void) setClassCount: (int)count
44{
45 c = count;
46}
47@end
48
49typedef MyRootClass MyType;
50
51int main (void)
52{
53 MyType *object = [[MyRootClass alloc] init];
54
55 object.count = 1974;
56 if (object.count != 1974)
57 abort ();
58
59 return 0;
60}
61
62