comparison gcc/testsuite/c-c++-common/Wcast-function-type.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* { dg-do compile } */
2 /* { dg-options "-Wcast-function-type" } */
3
4 int f(long);
5
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);
16
17 f1 *a;
18 f2 *b;
19 f3 *c;
20 f4 *d;
21 f5 *e;
22
23 void
24 foo (void)
25 {
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" } */
31 }