1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2 /* { dg-do compile } */
3 /* { dg-options "-Wno-protocol" } */
7 /* Test the -Wno-protocol flag. With this, at a class is accepted
8 (with no warnings) as conforming to a protocol even if some
9 protocol methods are implemented in the superclass. */
19 /* The superclass implements the method required by the protocol. */
20 @interface MyRootClass
27 @implementation MyRootClass
34 /* The subclass inherits the method (does not implement it directly)
35 but that still makes it conform to the protocol. No warnings. */
36 @interface MySubClass : MyRootClass <MyProtocol>
39 @implementation MySubClass
40 @end /* No warnings here. */
43 /* The subclass instead does not inherit the method method2 (and does
44 not implement it directly) so it does not conform to the
45 protocol MyProtocol2. */
46 @interface MySubClass2 : MyRootClass <MyProtocol2>
49 @implementation MySubClass2
50 @end /* Warnings here, below. */
51 /* { dg-warning "incomplete implementation of class .MySubClass2." "" { target *-*-* } .-1 } */
52 /* { dg-warning "method definition for .\\-method2. not found" "" { target *-*-* } .-2 } */
53 /* { dg-warning "class .MySubClass2. does not fully implement the .MyProtocol2. protocol" "" { target *-*-* } .-3 } */