aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/ivar-scope-1.m
blob: 64d275b44bd12c29d132cea525c87d5f8c750266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Test instance variable scope.  */
/* Author: Dimitris Papavasiliou <dpapavas@gmail.com>.  */
/* { dg-do compile } */
#include <objc/objc.h>

#if defined(__has_attribute) && __has_attribute(objc_root_class)
__attribute__((objc_root_class))
#endif
@interface MyClass
{
  int someivar;
}
- (void) test;
@end

@implementation MyClass
- (void) test
{
  int a;

  /* Make sure instance variables do have local scope when
     -fno-local-ivar isn't specified. */
  
  a = self->someivar;  /* No warning or error. */
  a = someivar;        /* No error. */
}
@end