Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / objc.dg / ivar-scope-2.m
blob1149d735d127bdb71cb354acbb2284747fe912cb
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 #if defined(__has_attribute) && __has_attribute(objc_root_class)
8 __attribute__((objc_root_class))
9 #endif
10 @interface MyClass
12   int someivar;
14 - (void) testscope;
15 - (void) testshadowing;
16 @end
18 @implementation MyClass
19 - (void) testscope
21   int a;
23   a = self->someivar;  /* No warning or error. */
24   a = someivar;        /* { dg-error ".someivar. undeclared" } */
27 - (void) testshadowing
29   int someivar = 1;
30   int a;
32   /* Since instance variables don't have local scope no shadowing
33      should occur. */
34   
35   a = someivar; /* No warning. */
37 @end