Add a debug counter for late-combine
[official-gcc.git] / gcc / testsuite / obj-c++.dg / protocol-inheritance-1.mm
blobc505c0083fa5cc836fd47f47ee5cdd59ad76c9b6
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
3 /* { dg-options "-Wno-protocol" } */
4 // { dg-additional-options "-Wno-objc-root-class" }
6 #include <objc/objc.h>
8 /* Test the -Wno-protocol flag.  With this, at a class is accepted
9    (with no warnings) as conforming to a protocol even if some
10    protocol methods are implemented in the superclass.  */
12 @protocol MyProtocol
13 - (int)method;
14 @end
16 @protocol MyProtocol2
17 - (int)method2;
18 @end
20 /* The superclass implements the method required by the protocol.  */
21 @interface MyRootClass
23   Class isa;
25 - (int)method;
26 @end
28 @implementation MyRootClass
29 - (int)method
31   return 23;
33 @end
35 /* The subclass inherits the method (does not implement it directly)
36    but that still makes it conform to the protocol.  No warnings.  */
37 @interface MySubClass : MyRootClass <MyProtocol>
38 @end
40 @implementation MySubClass
41 @end /* No warnings here.  */
44 /* The subclass instead does not inherit the method method2 (and does
45    not implement it directly) so it does not conform to the
46    protocol MyProtocol2.  */
47 @interface MySubClass2 : MyRootClass <MyProtocol2>
48 @end
50 @implementation MySubClass2
51 @end /* Warnings here, below.  */
52 /* { dg-warning "incomplete implementation of class .MySubClass2." "" { target *-*-* } .-1 } */
53 /* { dg-warning "method definition for .\\-method2. not found" "" { target *-*-* } .-2 } */
54 /* { dg-warning "class .MySubClass2. does not fully implement the .MyProtocol2. protocol" "" { target *-*-* } .-3 } */