2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / objc.dg / method-6.m
bloba4ca787b7f66ac5503fa42fc9593cd46e0077f8d
1 /* Check that sending messages to variables of type 'Class' does not involve instance methods,
2    unless they reside in root classes.  */
3 /* Author: Ziemowit Laski <zlaski@apple.com>  */
4 /* { dg-do compile } */
6 #include <objc/Protocol.h>
8 @interface Base
9 - (unsigned)port;
10 @end
12 @interface Derived: Base
13 - (Object *)port;
14 + (Protocol *)port;
15 - (id)starboard;
16 @end
18 void foo(void) {
19   Class receiver;
21   [receiver port];  /* { dg-warning "multiple methods named .\\+port. found" } */
22        /* { dg-warning "using .\\-\\(unsigned\\)port." "" { target *-*-* } 9 } */
23        /* { dg-warning "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 14 } */
25   [receiver starboard];  /* { dg-warning ".Class. may not respond to .\\+starboard." } */
26        /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 25 } */
27        /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 25 } */
28        /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 25 } */
30   [Class port];  /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */