summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/method-15.mm
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-24 22:18:43 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-24 22:18:43 +0000
commit60e21b9a40e681203f50eb0a47a0074e5cb5610e (patch)
tree873a8e69cb460b5a1ef680bc2aed0ef6291fcb5a /gcc/testsuite/obj-c++.dg/method-15.mm
parent7db325f3b1ce568c13381d6da66485636e2a59f8 (diff)
downloadgcc-60e21b9a40e681203f50eb0a47a0074e5cb5610e.tar.gz
* obj-c++.dg/bitfield-[1-5].mm: New.
* obj-c++.dg/class-protocol-1.mm: New. * obj-c++.dg/comp-types-1[0-1].mm: New. * obj-c++.dg/comp-types-[2-9].mm: New. * obj-c++.dg/encode-[4-8].mm: New. * obj-c++.dg/layout-1.mm: New. * obj-c++.dg/method-1[0-9].mm: New. * obj-c++.dg/method-2[0-1].mm: New. * obj-c++.dg/method-[8-9].mm: New. * obj-c++.dg/objc-gc-3.mm: New. * obj-c++.dg/try-catch-10.mm: New. * objc.dg/bitfield-5.m: New. * objc.dg/comp-types-10.m: New. * objc.dg/comp-types-9.m: New. * objc.dg/layout-1.m: New. * objc.dg/objc-gc-4.m: New. * objc.dg/try-catch-9.m: New. * objc.dg/class-protocol-1.m: Tweak diagnostics. * objc.dg/comp-types-1.m: Likewise. * objc.dg/comp-types-[5-6].m: Likewise. * objc.dg/method-9.m: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100121 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/method-15.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/method-15.mm43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/method-15.mm b/gcc/testsuite/obj-c++.dg/method-15.mm
new file mode 100644
index 00000000000..9d9099e9f7e
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/method-15.mm
@@ -0,0 +1,43 @@
+/* Check if finding multiple signatures for a method is handled gracefully when method lookup succeeds (see also method-7.m). */
+/* Contributed by Ziemowit Laski <zlaski@apple.com> */
+/* { dg-options "-Wstrict-selector-match" } */
+/* { dg-do compile } */
+
+#include <objc/Object.h>
+
+@protocol MyObject
+- (id)initWithData:(Object *)data;
+@end
+
+@protocol SomeOther
+- (id)initWithData:(int)data;
+@end
+
+@protocol MyCoding
+- (id)initWithData:(id<MyObject, MyCoding>)data;
+@end
+
+@interface NTGridDataObject: Object <MyCoding>
+{
+ Object<MyCoding> *_data;
+}
++ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data;
+@end
+
+@implementation NTGridDataObject
+- (id)initWithData:(id<MyObject, MyCoding>)data {
+ return data;
+}
++ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data
+{
+ NTGridDataObject *result = [[NTGridDataObject alloc] initWithData:data];
+ /* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 33 } */
+ /* { dg-warning "using .\\-\\(id\\)initWithData:\\(Object \\*\\)data." "" { target *-*-* } 9 } */
+ /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(id <MyObject, MyCoding>\\)data." "" { target *-*-* } 17 } */
+ /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(int\\)data." "" { target *-*-* } 13 } */
+
+ /* The following warning is a consequence of picking the "wrong" method signature. */
+ /* { dg-warning "passing argument 1 of .initWithData:. from distinct Objective\\-C type" "" { target *-*-* } 33 } */
+ return result;
+}
+@end