Patrick Beard | b2f6820 | 2012-04-06 18:12:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Wduplicate-method-arg -verify -Wno-objc-root-class %s |
Fariborz Jahanian | 7f53253 | 2011-02-09 22:20:01 +0000 | [diff] [blame] | 2 | |
| 3 | // rdar://8877730 |
| 4 | |
| 5 | int object; |
| 6 | |
| 7 | @class NSString, NSArray; |
| 8 | |
| 9 | @interface Test |
Fariborz Jahanian | 56242ba | 2012-06-21 18:43:08 +0000 | [diff] [blame] | 10 | - Func:(int)XXXX, id object; // expected-warning {{use of C-style parameters in Objective-C method declarations is deprecated}} |
Fariborz Jahanian | 7f53253 | 2011-02-09 22:20:01 +0000 | [diff] [blame] | 11 | |
| 12 | - doSomethingElseWith:(id)object; |
| 13 | |
Fariborz Jahanian | 90ba78c | 2011-03-12 18:54:30 +0000 | [diff] [blame] | 14 | - (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object; // expected-warning {{redeclaration of method parameter 'object'}} \ |
Fariborz Jahanian | 7f53253 | 2011-02-09 22:20:01 +0000 | [diff] [blame] | 15 | // expected-note {{previous declaration is here}} |
| 16 | @end |
| 17 | |
| 18 | @implementation Test |
| 19 | |
| 20 | - (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object // expected-warning {{redefinition of method parameter 'object'}} \ |
| 21 | // expected-note {{previous declaration is here}} |
| 22 | { |
| 23 | return object; // expected-warning {{incompatible pointer types returning 'NSArray *' from a function with result type 'NSString *'}} |
| 24 | } |
| 25 | |
Fariborz Jahanian | 56242ba | 2012-06-21 18:43:08 +0000 | [diff] [blame] | 26 | - Func:(int)XXXX, id object { return object; } // expected-warning {{use of C-style parameters in Objective-C method declarations is deprecated}} |
Fariborz Jahanian | 7f53253 | 2011-02-09 22:20:01 +0000 | [diff] [blame] | 27 | |
| 28 | - doSomethingElseWith:(id)object { return object; } |
| 29 | |
| 30 | @end |
| 31 | |
| 32 | struct P; |
| 33 | |
| 34 | @interface Test1 |
| 35 | - doSomethingWith:(struct S *)object and:(struct P *)obj; // expected-warning {{declaration of 'struct S' will not be visible outside of this function}} |
| 36 | @end |
| 37 | |
| 38 | int obj; |