view clang/test/SemaObjC/ivar-lookup-resolution-builtin.m @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents c4bab56944e8
children
line wrap: on
line source

// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
// pr5986

@interface Test {
  int index;
}
- (int) index;
+ (int) ClassMethod;
@end

@implementation Test
- (int) index
{
  return index;
}
+ (int) ClassMethod
{
  return index;	// expected-error {{instance variable 'index' accessed in class method}}
}
@end

@interface Test1 {
}
- (int) InstMethod;
+ (int) ClassMethod;
@end

@implementation Test1
- (int) InstMethod
{
  return index;	// expected-error {{call to undeclared library function 'index'}}	\
                // expected-note {{include the header <strings.h> or explicitly provide a declaration for 'index'}} \
                // expected-error {{incompatible pointer to integer conversion returning}}
}
+ (int) ClassMethod
{
  return index; // expected-error {{incompatible pointer to integer conversion returning}}
}
@end