Do not warn with -Wuninitialized when the member is used in a sizeof or address-of...
[clang.git] / test / SemaObjC / class-method-lookup.m
blobf26d692328a2349f7c59597b33d5f8f3ff8875a7
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 @interface MyBase 
4 - (void) rootInstanceMethod;
5 @end
7 @interface MyIntermediate: MyBase
8 @end
10 @interface MyDerived: MyIntermediate
11 - (void) instanceMethod;
12 + (void) classMethod;
13 @end
15 @implementation MyDerived
16 - (void) instanceMethod {
19 + (void) classMethod {                    /* If a class method is not found, the root  */
20     [self rootInstanceMethod];            /* class is searched for an instance method  */
21     [MyIntermediate rootInstanceMethod];  /* with the same name.                       */
23     [self instanceMethod];// expected-warning {{'-instanceMethod' not found (return type defaults to 'id')}}
24     [MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
26 @end
28 @interface Object @end
30 @interface Class1
31 - (void)setWindow:(Object *)wdw;
32 @end
34 @interface Class2
35 - (void)setWindow:(Class1 *)window;
36 @end
38 #define nil (void*)0
40 id foo(void) {
41   Object *obj;
42   id obj2 = obj;
43   [obj setWindow:nil]; // expected-warning {{'Object' may not respond to 'setWindow:'}}
45   return obj;