1 // RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wcast-function-type -Wno-cast-function-type-strict -verify
5 typedef int (f1
)(long);
6 typedef int (f2
)(void*);
8 typedef void (f4
)(...);
9 typedef void (f5
)(void);
10 typedef int (f6
)(long, int);
11 typedef int (f7
)(long,...);
12 typedef int (&f8
)(long, int);
28 typedef void (S::*mf
)(int);
32 b
= (f2
*)x
; // expected-warning {{cast from 'int (*)(long)' to 'f2 *' (aka 'int (*)(void *)') converts to incompatible function type}}
33 b
= reinterpret_cast<f2
*>(x
); // expected-warning {{cast from 'int (*)(long)' to 'f2 *' (aka 'int (*)(void *)') converts to incompatible function type}}
35 d
= (f4
*)x
; // expected-warning {{cast from 'int (*)(long)' to 'f4 *' (aka 'void (*)(...)') converts to incompatible function type}}
37 f
= (f6
*)x
; // expected-warning {{cast from 'int (*)(long)' to 'f6 *' (aka 'int (*)(long, int)') converts to incompatible function type}}
40 mf p1
= (mf
)&S::foo
; // expected-warning {{cast from 'void (S::*)(int *)' to 'mf' (aka 'void (S::*)(int)') converts to incompatible function type}}
42 f8 f2
= (f8
)x
; // expected-warning {{cast from 'int (long)' to 'f8' (aka 'int (&)(long, int)') converts to incompatible function type}}
46 f
= (f6
*)y
; // expected-warning {{cast from 'int (^)(long)' to 'f6 *' (aka 'int (*)(long, int)') converts to incompatible function type}}