[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Sema / warn-cast-function-type-strict.c
blob5233680796e972b27526f8ab7fe173dbbe119139
1 // RUN: %clang_cc1 %s -fsyntax-only -Wcast-function-type -verify
2 // RUN: %clang_cc1 %s -fsyntax-only -Wcast-function-type-strict -verify
5 int t(int array[static 12]);
6 int u(int i);
7 const int v(int i);
8 int x(long);
10 typedef int (f1)(long);
11 typedef int (f2)(void*);
12 typedef int (f3)();
13 typedef void (f4)();
14 typedef void (f5)(void);
15 typedef int (f6)(long, int);
16 typedef int (f7)(long,...);
17 typedef int (f8)(int *);
18 typedef int (f9)(const int);
19 typedef int (f10)(int);
21 f1 *a;
22 f2 *b;
23 f3 *c;
24 f4 *d;
25 f5 *e;
26 f6 *f;
27 f7 *g;
28 f8 *h;
29 f9 *i;
30 f10 *j;
32 void foo(void) {
33 a = (f1 *)x;
34 b = (f2 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f2 *' (aka 'int (*)(void *)') converts to incompatible function type}} */
35 c = (f3 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f3 *' (aka 'int (*)()') converts to incompatible function type}} */
36 d = (f4 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f4 *' (aka 'void (*)()') converts to incompatible function type}} */
37 e = (f5 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f5 *' (aka 'void (*)(void)') converts to incompatible function type}} */
38 f = (f6 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f6 *' (aka 'int (*)(long, int)') converts to incompatible function type}} */
39 g = (f7 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f7 *' (aka 'int (*)(long, ...)') converts to incompatible function type}} */
40 h = (f8 *)t;
41 i = (f9 *)u;
42 j = (f10 *)v; /* expected-warning {{cast from 'const int (*)(int)' to 'f10 *' (aka 'int (*)(int)') converts to incompatible function type}} */