Don't warn when alignment of global common data exceeds maximum alignment.
[official-gcc.git] / gcc / testsuite / objc.dg / private-1.m
blob5bd29e5939b1c30ffc87d2f2b426e5a1e1b2ed69
1 /* Test errors for accessing @private and @protected variables.  */
2 /* Author: Nicola Pero <nicola@brainstorm.co.uk>.  */
3 /* { dg-do compile } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
5 #include <objc/objc.h>
7 @interface MySuperClass
9 @private
10   int private;
12 @protected
13   int protected;
15 @public
16   int public;
18 - (void) test;
19 @end
21 @implementation MySuperClass
22 - (void) test
24   private = 12;   /* Ok  */
25   protected = 12; /* Ok  */
26   public = 12;    /* Ok  */
28 @end
31 @interface MyClass : MySuperClass 
32 @end
34 @implementation MyClass
35 - (void) test
37   /* Private variables simply don't exist in the subclass.  */
38   private = 12;  /* { dg-error "instance variable" } */
39   /* { dg-message "function it appears in" "" { target *-*-* } .-1 } */
41   protected = 12; /* Ok  */
42   public = 12;    /* Ok  */
44 @end
46 int main (void)
48   MyClass *m = nil;
49   
50   if (m != nil)
51     {
52       int access;
54       access = m->private;   /* { dg-warning "is @private" }  */
55       access = m->protected; /* { dg-warning "is @protected" }  */
56       access = m->public;    /* Ok  */
57     }
59   return 0;