| 1 |
/* Ensure that the compiler gracefully handles missing protocol declarations. |
| 2 |
In addition to not crashing :-), the compiler should properly handle |
| 3 |
valid protocol references, even when they're mixed with invalid ones. */ |
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-additional-options "-Wno-objc-root-class" } */ |
| 6 |
|
| 7 |
#include <objc/objc.h> |
| 8 |
|
| 9 |
@protocol DefinedProtocol |
| 10 |
- (id) missingMethod1; |
| 11 |
@end |
| 12 |
|
| 13 |
@interface MyClass <UndefinedProtocol, DefinedProtocol> |
| 14 |
/* { dg-error "cannot find protocol declaration for .UndefinedProtocol." "" { target *-*-* } .-1 } */ |
| 15 |
@end |
| 16 |
|
| 17 |
@implementation MyClass |
| 18 |
+(Class)class |
| 19 |
{ |
| 20 |
return self; |
| 21 |
} |
| 22 |
@end |
| 23 |
/* { dg-warning "incomplete implementation of class .MyClass." "" { target *-*-* } .-1 } */ |
| 24 |
/* { dg-warning "method definition for .\\-missingMethod1. not found" "" { target *-*-* } .-2 } */ |
| 25 |
/* { dg-warning "class .MyClass. does not fully implement the .DefinedProtocol. protocol" "" { target *-*-* } .-3 } */ |
| 26 |
|