PR tree-optimization/86401
[official-gcc.git] / gcc / testsuite / c-c++-common / Wcast-function-type.c
blob81105762ef73cfd0ff17bd80b271bb9d54c1a598
1 /* { dg-do compile } */
2 /* { dg-options "-Wcast-function-type" } */
4 int f(long);
6 typedef int (f1)(long);
7 typedef int (f2)(void*);
8 #ifdef __cplusplus
9 typedef int (f3)(...);
10 typedef void (f4)(...);
11 #else
12 typedef int (f3)();
13 typedef void (f4)();
14 #endif
15 typedef void (f5)(void);
17 f1 *a;
18 f2 *b;
19 f3 *c;
20 f4 *d;
21 f5 *e;
23 void
24 foo (void)
26 a = (f1 *) f; /* { dg-bogus "incompatible function types" } */
27 b = (f2 *) f; /* { dg-warning "incompatible function types" } */
28 c = (f3 *) f; /* { dg-bogus "incompatible function types" } */
29 d = (f4 *) f; /* { dg-warning "incompatible function types" } */
30 e = (f5 *) f; /* { dg-bogus "incompatible function types" } */