1 | // RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify -Wno-objc-root-class %s |
2 | |
3 | @interface foo |
4 | - (int)meth; |
5 | @end |
6 | |
7 | @implementation foo |
8 | - (int) meth { return [self meth]; } |
9 | @end |
10 | |
11 | // PR2708 |
12 | @interface MyClass |
13 | +- (void)myMethod; // expected-error {{expected selector for Objective-C method}} |
14 | - (vid)myMethod2; // expected-error {{expected a type}} |
15 | @end |
16 | |
17 | @implementation MyClass |
18 | - (void)myMethod { } |
19 | - (vid)myMethod2 { } // expected-error {{expected a type}} |
20 | |
21 | @end |
22 | |
23 | |
24 | @protocol proto; |
25 | @protocol NSObject; |
26 | |
27 | //@protocol GrowlPluginHandler <NSObject> @end |
28 | |
29 | |
30 | @interface SomeClass2 |
31 | - (int)myMethod1: (id<proto>) |
32 | arg; // expected-note {{previous definition is here}} |
33 | @end |
34 | |
35 | @implementation SomeClass2 |
36 | - (int)myMethod1: (id<NSObject>) |
37 | arg { // expected-warning {{conflicting parameter types in implementation of 'myMethod1:': 'id<proto>' vs 'id<NSObject>'}} |
38 | |
39 | } |
40 | @end |
41 | |