1 // RUN: %clang_cc1 -x c %s -fsyntax-only -Wcast-function-type -triple x86_64-- -verify 2 3 int x(long); 4 5 typedef int (f1)(long); 6 typedef int (f2)(void*); 7 typedef int (f3)(); 8 typedef void (f4)(); 9 typedef void (f5)(void); 10 typedef int (f6)(long, int); 11 typedef int (f7)(long,...); 12 13 f1 *a; 14 f2 *b; 15 f3 *c; 16 f4 *d; 17 f5 *e; 18 f6 *f; 19 f7 *g; 20 21 void foo(void) { 22 a = (f1 *)x; 23 b = (f2 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f2 *' (aka 'int (*)(void *)') converts to incompatible function type}} */ 24 c = (f3 *)x; 25 d = (f4 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f4 *' (aka 'void (*)()') converts to incompatible function type}} */ 26 e = (f5 *)x; 27 f = (f6 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f6 *' (aka 'int (*)(long, int)') converts to incompatible function type}} */ 28 g = (f7 *)x; 29 } 30