diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-19 19:10:40 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-19 19:10:40 +0000 |
commit | d7174f2924a18e6e6754575d80db405aac9168c8 (patch) | |
tree | e417ce593a19bb7ff18deb80909b2a5735b3436f | |
parent | c5e869b7949d162ee93c6200c0100a27544bdaa3 (diff) |
More tests for Objective-C-related name lookup weirdness. Yes, it's
weird; yes, it's what GCC does. Almost.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101803 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/SemaObjC/ivar-lookup.m | 19 | ||||
-rw-r--r-- | test/SemaObjCXX/ivar-lookup.mm | 18 |
2 files changed, 37 insertions, 0 deletions
diff --git a/test/SemaObjC/ivar-lookup.m b/test/SemaObjC/ivar-lookup.m index 644b3b638c..06e47116f7 100644 --- a/test/SemaObjC/ivar-lookup.m +++ b/test/SemaObjC/ivar-lookup.m @@ -16,3 +16,22 @@ extern struct foo x; } @end + +@interface Ivar +- (float*)method; +@end + +@interface A { + A *Ivar; +} +- (int*)method; +@end + +@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; +} +@end + diff --git a/test/SemaObjCXX/ivar-lookup.mm b/test/SemaObjCXX/ivar-lookup.mm new file mode 100644 index 0000000000..bb26f48f13 --- /dev/null +++ b/test/SemaObjCXX/ivar-lookup.mm @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +@interface Ivar +- (float*)method; +@end + +@interface A { + A *Ivar; +} +- (int*)method; +@end + +@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; +} +@end |