1 // RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wcast-function-type -verify
2 // RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wcast-function-type-strict -verify
6 typedef int (f1
)(long);
7 typedef int (f2
)(void*);
9 typedef void (f4
)(...);
10 typedef void (f5
)(void);
11 typedef int (f6
)(long, int);
12 typedef int (f7
)(long,...);
13 typedef int (&f8
)(long, int);
29 typedef void (S::*mf
)(int);
33 b
= (f2
*)x
; // expected-warning {{cast from 'int (*)(long)' to 'f2 *' (aka 'int (*)(void *)') converts to incompatible function type}}
34 b
= reinterpret_cast<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 (*)()') 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}}
41 mf p1
= (mf
)&S::foo
; // expected-warning {{cast from 'void (S::*)(int *)' to 'mf' (aka 'void (S::*)(int)') converts to incompatible function type}}
43 f8 f2
= (f8
)x
; // expected-warning {{cast from 'int (long)' to 'f8' (aka 'int (&)(long, int)') converts to incompatible function type}}
47 f
= (f6
*)y
; // expected-warning {{cast from 'int (^)(long)' to 'f6 *' (aka 'int (*)(long, int)') converts to incompatible function type}}