From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/objc.dg/property/dotsyntax-15.m | 80 +++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 gcc/testsuite/objc.dg/property/dotsyntax-15.m (limited to 'gcc/testsuite/objc.dg/property/dotsyntax-15.m') diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-15.m b/gcc/testsuite/objc.dg/property/dotsyntax-15.m new file mode 100644 index 000000000..767f6a2b8 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-15.m @@ -0,0 +1,80 @@ +/* Contributed by Nicola Pero , November 2010. */ +/* { dg-do compile } */ + +/* Test dot-syntax with accessors to be looked up in protocols. */ + +#include +#include +#include + +@protocol ProtocolA +- (int) countA; +- (void) setCountA: (int)aNumber; +@end + +@protocol ProtocolB +- (int) countB; +- (void) setCountB: (int)aNumber; +@end + +@protocol ProtocolC +- (int) countC; +- (void) setCountC: (int)aNumber; +@end + +@interface MyRootClass +{ + Class isa; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +@end + +@interface MySubClass +@end + +int function (MySubClass *object, int x) +{ + object.countA = x; + object.countB = x; + object.countC = object.countB; + + return object.countC; +} + +int function2 (MyRootClass *object, int x) +{ + object.countA = x; + object.countB = x; + object.countC = object.countB; + + return object.countC; +} + +int function3 (MyRootClass *object, int x) +{ + object.countA = x; + object.countB = x; + object.countC = object.countB; /* { dg-error "request for member .countC. in something not a structure or union" } */ + + return object.countC; /* { dg-error "request for member .countC. in something not a structure or union" } */ +} + +int function4 (id object, int x) +{ + object.countA = x; + object.countB = x; + object.countC = object.countB; + + return object.countC; +} + +int function5 (id object, int x) +{ + object.countA = x; + object.countB = x; + object.countC = object.countB; /* { dg-error "request for member .countC. in something not a structure or union" } */ + + return object.countC; /* { dg-error "request for member .countC. in something not a structure or union" } */ +} -- cgit v1.2.3