Steve Naroff | 5266418 | 2007-10-16 23:12:48 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | |
Steve Naroff | 5266418 | 2007-10-16 23:12:48 +0000 | [diff] [blame] | 3 | struct S { int a; }; |
| 4 | |
| 5 | extern int charStarFunc(char *); |
| 6 | extern int charFunc(char); |
| 7 | |
| 8 | @interface Test |
| 9 | +alloc; |
| 10 | -(int)charStarMeth:(char *)s; |
| 11 | -structMeth:(struct S)s; |
| 12 | -structMeth:(struct S)s :(struct S)s2; |
| 13 | @end |
| 14 | |
| 15 | void test() { |
| 16 | id obj = [Test alloc]; |
| 17 | struct S sInst; |
| 18 | |
| 19 | charStarFunc(1); // expected-warning {{incompatible types passing 'int' to function expecting 'char *'}} |
| 20 | charFunc("abc"); // expected-warning {{incompatible types passing 'char *' to function expecting 'char'}} |
| 21 | |
| 22 | [obj charStarMeth:1]; // expected-warning {{incompatible types passing 'int' to method expecting 'char *'}} |
| 23 | [obj structMeth:1]; // expected-error {{incompatible types passing 'int' to method expecting 'struct S'}} |
| 24 | [obj structMeth:sInst :1]; // expected-error {{incompatible types passing 'int' to method expecting 'struct S'}} |
| 25 | } |