Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1  -fsyntax-only -Wundeclared-selector -verify -Wno-objc-root-class %s
      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);
     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 }
     46