Debian Codegraph @

gcc/testsuite/objc.dg/property/property-1.m

raw
1 /* This program tests use of property provided setter/getter functions. */
2 /* { dg-options "-std=c99" } */
3 /* { dg-do run } */
4 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
5
6 #import "../../objc-obj-c++-shared/TestsuiteObject.m"
7
8 @interface Bar : TestsuiteObject
9 {
10 int iVar;
11 }
12 @property (setter=MySetter:) int FooBar;
13 @end
14
15 @implementation Bar
16 @synthesize FooBar=iVar;
17
18 - (void) MySetter : (int) value { iVar = value; }
19
20 @end
21
22 int main(int argc, char *argv[]) {
23 Bar *f = [Bar new];
24 f.FooBar = 1;
25
26 f.FooBar += 3;
27
28 f.FooBar -= 4;
29 return f.FooBar;
30 }
31