2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / objc.dg / undeclared-selector.m
blob1cfc6c834812d18a6c0a446357d2552d32aa5fac
1 /* Test for -Wundeclared-selector.  */
2 /* Author: Nicola Pero <nicola@brainstorm.co.uk>.  */
3 /* { dg-do compile } */
4 /* { dg-options "-Wundeclared-selector" } */
6 #include <objc/objc.h>
8 @interface MyClass
10 + (void) methodA;
11 - (void) methodB;
12 + (void) methodD;
13 - (void) methodF;
15 @end
17 @implementation MyClass
19 + (void) methodA {}
20 - (void) methodB {}
21 + (void) methodD
23   SEL d = @selector(methodD); /* Ok */
24   SEL e = @selector(methodE); /* { dg-warning "undeclared selector" } */
27 - (void) methodE
29   SEL e = @selector(methodE); /* Ok */
32 - (void) methodF
34   SEL e = @selector(methodE); /* Ok */
37 @end
39 int main (void)
41   SEL a = @selector(methodA); /* Ok */
42   SEL b = @selector(methodB); /* Ok */
43   SEL c = @selector(methodC); /* { dg-warning "undeclared selector" } */
44   SEL d = @selector(methodD); /* Ok */
45   SEL e = @selector(methodE); /* Ok */
46   return 0;
47