diff clang/test/SemaObjC/ivar-lookup-resolution-builtin.m @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children c4bab56944e8
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/clang/test/SemaObjC/ivar-lookup-resolution-builtin.m	Thu Feb 13 15:10:13 2020 +0900
@@ -0,0 +1,40 @@
+// 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-warning {{implicitly declaring library function 'index'}}	\
+                // expected-note {{include the header <strings.h> or explicitly provide a declaration for 'index'}} \
+                // expected-warning {{incompatible pointer to integer conversion returning}}
+}
++ (int) ClassMethod
+{
+  return index; // expected-warning {{incompatible pointer to integer conversion returning}}
+}
+@end
+