| 1 |
/* Contributed by Nicola Pero <[email protected]>, November 2010. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-additional-options "-Wno-objc-root-class" } */ |
| 4 |
|
| 5 |
/* Test that a duplicated @implementation for the same class does not |
| 6 |
crash the compiler. */ |
| 7 |
|
| 8 |
@interface Test |
| 9 |
{ |
| 10 |
Class isa; |
| 11 |
} |
| 12 |
- (int) test; |
| 13 |
@end |
| 14 |
|
| 15 |
@implementation Test |
| 16 |
- (int) test |
| 17 |
{ |
| 18 |
return 4; |
| 19 |
} |
| 20 |
@end |
| 21 |
|
| 22 |
/* The most likely cause is that the programmer meant this to be a |
| 23 |
category, so check what happens if we have some different methods |
| 24 |
in there. */ |
| 25 |
@implementation Test |
| 26 |
- (int) test2 /* { dg-error "reimplementation of class .Test." } */ |
| 27 |
{ |
| 28 |
return [self test]; |
| 29 |
} |
| 30 |
@end |
| 31 |
/* { dg-warning "incomplete implementation" "" { target *-*-* } .-1 } */ |
| 32 |
/* { dg-warning "not found" "" { target *-*-* } .-2 } */ |