| 1 |
// RUN: %clang_cc1 -fsyntax-only -Wduplicate-method-arg -verify -Wno-objc-root-class %s |
| 2 |
|
| 3 |
int object; |
| 4 |
|
| 5 |
@class NSString, NSArray; |
| 6 |
|
| 7 |
@interface Test |
| 8 |
- Func:(int)XXXX, id object; // expected-warning {{use of C-style parameters in Objective-C method declarations is deprecated}} |
| 9 |
|
| 10 |
- doSomethingElseWith:(id)object; |
| 11 |
|
| 12 |
- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object; // expected-warning {{redeclaration of method parameter 'object'}} \ |
| 13 |
// expected-note {{previous declaration is here}} |
| 14 |
@end |
| 15 |
|
| 16 |
@implementation Test |
| 17 |
|
| 18 |
- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object // expected-warning {{redefinition of method parameter 'object'}} \ |
| 19 |
// expected-note {{previous declaration is here}} |
| 20 |
{ |
| 21 |
return object; // expected-error {{incompatible pointer types returning 'NSArray *' from a function with result type 'NSString *'}} |
| 22 |
} |
| 23 |
|
| 24 |
- Func:(int)XXXX, id object { return object; } // expected-warning {{use of C-style parameters in Objective-C method declarations is deprecated}} |
| 25 |
|
| 26 |
- doSomethingElseWith:(id)object { return object; } |
| 27 |
|
| 28 |
@end |
| 29 |
|
| 30 |
struct P; |
| 31 |
|
| 32 |
@interface Test1 |
| 33 |
- doSomethingWith:(struct S *)object and:(struct P *)obj; // expected-warning {{declaration of 'struct S' will not be visible outside of this function}} |
| 34 |
@end |
| 35 |
|
| 36 |
int obj; |