[cfe-commits] r101803 - in /cfe/trunk/test: SemaObjC/ivar-lookup.m SemaObjCXX/ivar-lookup.mm

Douglas Gregor dgregor at apple.com
Mon Apr 19 12:10:40 PDT 2010


Author: dgregor
Date: Mon Apr 19 14:10:40 2010
New Revision: 101803

URL: http://llvm.org/viewvc/llvm-project?rev=101803&view=rev
Log:
More tests for Objective-C-related name lookup weirdness. Yes, it's
weird; yes, it's what GCC does. Almost.

Added:
    cfe/trunk/test/SemaObjCXX/ivar-lookup.mm
Modified:
    cfe/trunk/test/SemaObjC/ivar-lookup.m

Modified: cfe/trunk/test/SemaObjC/ivar-lookup.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/ivar-lookup.m?rev=101803&r1=101802&r2=101803&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/ivar-lookup.m (original)
+++ cfe/trunk/test/SemaObjC/ivar-lookup.m Mon Apr 19 14:10:40 2010
@@ -16,3 +16,22 @@
 }
 
 @end
+
+ at interface Ivar
+- (float*)method;
+ at end
+
+ at interface A {
+  A *Ivar;
+}
+- (int*)method;
+ at end
+
+ at implementation A
+- (int*)method {
+  int *ip = [Ivar method]; // expected-warning{{warning: incompatible pointer types initializing 'int *' with an expression of type 'float *'}}
+                           // Note that there is no warning in Objective-C++
+  return 0;
+}
+ at end
+

Added: cfe/trunk/test/SemaObjCXX/ivar-lookup.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/ivar-lookup.mm?rev=101803&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/ivar-lookup.mm (added)
+++ cfe/trunk/test/SemaObjCXX/ivar-lookup.mm Mon Apr 19 14:10:40 2010
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+ at interface Ivar
+- (float*)method;
+ at end
+
+ at interface A {
+  A *Ivar;
+}
+- (int*)method;
+ at end
+
+ at implementation A
+- (int*)method {
+  int *ip = [Ivar method]; // Okay; calls A's method on the instance variable Ivar.
+                           // Note that Objective-C calls Ivar's method.
+  return 0;
+}
+ at end





More information about the cfe-commits mailing list