]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaObjC/argument-checking.m
Update clang to r89205.
[FreeBSD/FreeBSD.git] / test / SemaObjC / argument-checking.m
1 // RUN: clang-cc -fsyntax-only -verify -pedantic %s
2
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 integer to pointer conversion passing 'int', expected 'char *'}}
20   charFunc("abc"); // expected-warning {{incompatible pointer to integer conversion passing 'char [4]', expected 'char'}}
21
22   [obj charStarMeth:1]; // expected-warning {{incompatible integer to pointer conversion sending 'int'}}
23   [obj structMeth:1]; // expected-error {{incompatible type sending 'int'}}
24   [obj structMeth:sInst :1]; // expected-error {{incompatible type sending 'int'}}
25 }