In gcc/testsuite/: 2011-03-04 Nicola Pero <nicola.pero@meta-innovation.com>
[official-gcc.git] / gcc / testsuite / objc.dg / property / property-1.m
blob147f007b946bdbd04e9a2f43a94b06b5fa5d2c45
1 /* This program tests use of property provided setter/getter functions. */
2 /* { dg-options "-std=c99" } */
3 /* { dg-do run } */
4 /* { dg-additional-sources "../../objc-obj-c++-shared/Object1.m" } */
5 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
7 #import "../../objc-obj-c++-shared/Object1.h"
9 @interface Bar : Object
11   int iVar;
13 @property (setter=MySetter:) int FooBar;
14 @end
16 @implementation Bar
17 @synthesize FooBar=iVar;
19 - (void) MySetter : (int) value { iVar = value; }
21 @end
23 int main(int argc, char *argv[]) {
24     Bar *f = [Bar new];
25     f.FooBar = 1;
27     f.FooBar += 3;
29     f.FooBar -= 4;
30     return f.FooBar;