]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/obj-c++.dg/method-12.mm
trans.c (check_inlining_for_nested_subprog): Quote reserved names.
[thirdparty/gcc.git] / gcc / testsuite / obj-c++.dg / method-12.mm
CommitLineData
d1e270fe
ZL
1/* Check that sending messages to variables of type 'Class' does not involve instance methods, unless they reside in root classes. */
2/* Author: Ziemowit Laski <zlaski@apple.com> */
3/* { dg-options "-Wstrict-selector-match" } */
4/* { dg-do compile } */
1c858af5 5/* { dg-skip-if "Object interface removed" { *-*-darwin[1-2]* && { lp64 } } { "-fnext-runtime" } { "" } } */
d1e270fe 6
88b470b8 7#include <objc/Protocol.h>
d1e270fe
ZL
8
9@interface Base
b5be38bc 10- (unsigned)port; /* { dg-line Base_port } */
d1e270fe
ZL
11@end
12
13@interface Derived: Base
14- (Object *)port;
b5be38bc 15+ (Protocol *)port; /* { dg-line Derived_port_last } */
d1e270fe
ZL
16- (id)starboard;
17@end
18
19void foo(void) {
20 Class receiver;
21
22 [receiver port]; /* { dg-warning "multiple methods named .\\+port. found" } */
b5be38bc
TV
23 /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } Base_port } */
24 /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } Derived_port_last } */
d1e270fe
ZL
25
26 [receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */
a9c697b8 27 /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */
d1e270fe
ZL
28
29 [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */
30}