PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / objc.dg / ivar-scope-2.m
blobff795d08d6a352f945b7ac71eb90475acc190d9e
1 /* Test instance variable scope.  */
2 /* Author: Dimitris Papavasiliou <dpapavas@gmail.com>.  */
3 /* { dg-do compile } */
4 /* { dg-additional-options "-fno-local-ivars" } */
5 #include <objc/objc.h>
7 @interface MyClass
9   int someivar;
11 - (void) testscope;
12 - (void) testshadowing;
13 @end
15 @implementation MyClass
16 - (void) testscope
18   int a;
20   a = self->someivar;  /* No warning or error. */
21   a = someivar;        /* { dg-error ".someivar. undeclared" } */
24 - (void) testshadowing
26   int someivar = 1;
27   int a;
29   /* Since instance variables don't have local scope no shadowing
30      should occur. */
31   
32   a = someivar; /* No warning. */
34 @end