Rename __{float,double}_u to __x86_{float,double}_u to avoid pulluting the namespace.
[official-gcc.git] / gcc / testsuite / obj-c++.dg / private-1.mm
blob2173b90053043eb1680eed4ca7c16db7f1d2d269
1 /* Test errors for accessing @private and @protected variables.  */
2 /* Based on work by: 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 \\'_private\\' is declared private" } */
40   _protected = 12; /* Ok  */
41   _public = 12;    /* Ok  */
43 @end
45 int main (void)
47   MyClass *m = nil;
48   
49   if (m != nil)
50     {
51       int access;
53       access = m->_private;   /* { dg-warning "is @private" }  */
54       access = m->_protected; /* { dg-warning "is @protected" }  */
55       access = m->_public;    /* Ok  */
56     }
58   return 0;