1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2 /* { dg-do compile } */
4 /* Test warnings and non-warnings with @optional @properties. */
8 #include <objc/runtime.h>
10 @interface MyRootClass
19 @implementation MyRootClass
20 + (id) initialize { return self; }
21 + (id) alloc { return class_createInstance (self, 0); }
22 - (id) init { return self; }
28 @property (readonly) int count2;
32 /* A class that implements all the properties. */
33 @interface MySubClass1 : MyRootClass <count>
40 @implementation MySubClass1
46 /* A class that implements nothing; no warnings as the properties are
48 @interface MySubClass2 : MyRootClass <count>
51 @implementation MySubClass2
58 @property (readonly) int count2;
61 /* A class that implements all the properties. */
62 @interface MySubClass3 : MyRootClass <count2>
69 @implementation MySubClass3
75 /* A class that implements nothing; warnings as the properties are
77 @interface MySubClass4 : MyRootClass <count2>
80 @implementation MySubClass4
83 /* { dg-warning "incomplete implementation of class" "" { target *-*-* } 81 } */
84 /* { dg-warning "method definition for ..setCount1:. not found" "" { target *-*-* } 81 } */
85 /* { dg-warning "method definition for ..count1. not found" "" { target *-*-* } 81 } */
86 /* { dg-warning "method definition for ..count2. not found" "" { target *-*-* } 81 } */
87 /* { dg-warning "class .MySubClass4. does not fully implement the .count2. protocol" "" { target *-*-* } 81 } */