1 /* Check if objc_super stack variables are created correctly (and
2 not clobbered by other values). */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>. */
4 /* { dg-options "-std=c99 -lobjc" } */
8 #include <objc/Object.h>
10 extern void abort(void);
12 #define CHECK_IF(expr) if(!(expr)) abort();
14 typedef struct _Point {
19 Point MakePoint ( float x , float y ) {
26 @interface Base: Object
27 - ( void ) translateOriginToPoint : ( Point ) translation ;
30 @interface Derived : Base
31 - ( void ) scrollToPoint : ( Point ) newOrigin ;
32 - ( void ) translateOriginToPoint : ( Point ) translation ;
39 - ( void ) translateOriginToPoint : ( Point ) translation {
40 result = translation.x + translation.y;
44 @implementation Derived
45 - ( void ) scrollToPoint : ( Point ) newOrigin {
46 float transDeltaX =newOrigin.x, transDeltaY =newOrigin.y ;
49 w.x = transDeltaX ; w.y = transDeltaY ;
50 [ super translateOriginToPoint : w ] ;
53 [ super translateOriginToPoint : MakePoint ( transDeltaX , transDeltaY ) ] ;
56 - (void) translateOriginToPoint : ( Point ) translation {
57 /* This should never be called. */
63 Derived *v = [Derived new];
66 [v scrollToPoint: MakePoint(1.5, 1.5)];
67 CHECK_IF(result == r0);
69 [v scrollToPoint: MakePoint(1.5, 1.5)];
70 CHECK_IF(result == r0);
72 [v scrollToPoint: MakePoint(1.5, 1.5)];
73 CHECK_IF(result == r0);