Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Wundeclared-selector -verify %s |
Fariborz Jahanian | 0b6b0e9 | 2009-06-16 17:57:28 +0000 | [diff] [blame] | 2 | |
| 3 | typedef struct objc_selector *SEL; |
| 4 | |
| 5 | @interface MyClass |
| 6 | |
| 7 | + (void) methodA; |
| 8 | - (void) methodB; |
| 9 | + (void) methodD; |
| 10 | - (void) methodF; |
| 11 | |
| 12 | @end |
| 13 | |
| 14 | @implementation MyClass |
| 15 | |
| 16 | + (void) methodA {} |
| 17 | - (void) methodB {} |
| 18 | + (void) methodD |
| 19 | { |
| 20 | SEL d = @selector(methodD); /* Ok */ |
| 21 | SEL e = @selector(methodE); // expected-warning {{undeclared selector 'methodE'}} |
| 22 | } |
| 23 | |
| 24 | - (void) methodE |
| 25 | { |
| 26 | SEL e = @selector(methodE); /* Ok */ |
| 27 | } |
| 28 | |
| 29 | - (void) methodF |
| 30 | { |
| 31 | SEL e = @selector(methodE); /* Ok */ |
| 32 | } |
| 33 | |
| 34 | @end |
| 35 | |
| 36 | int main (void) |
| 37 | { |
| 38 | SEL a = @selector(methodA); /* Ok */ |
| 39 | SEL b = @selector(methodB); /* Ok */ |
| 40 | SEL c = @selector(methodC); // expected-warning {{undeclared selector 'methodC'}} |
| 41 | SEL d = @selector(methodD); /* Ok */ |
| 42 | SEL e = @selector(methodE); /* Ok */ |
| 43 | return 0; |
| 44 | |
| 45 | } |