]>
git.proxmox.com Git - rustc.git/blob - src/llvm/tools/clang/test/Sema/warn-bad-function-cast.c
1 // RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wbad-function-cast -triple x86_64-unknown-unknown -verify
10 _Complex
double cf(void);
11 enum e
{ E1
} ef(void);
19 /* Casts to void types are always OK. */
24 /* Casts to the same type or similar types are OK. */
35 /* All following casts issue warning */
36 (float)if1(); /* expected-warning {{cast from function call of type 'int' to non-matching type 'float'}} */
37 (double)if2(); /* expected-warning {{cast from function call of type 'char' to non-matching type 'double'}} */
38 (_Bool
)if3(); /* expected-warning {{cast from function call of type 'long' to non-matching type '_Bool'}} */
39 (int)rf1(); /* expected-warning {{cast from function call of type 'float' to non-matching type 'int'}} */
40 (long)rf2(); /* expected-warning {{cast from function call of type 'double' to non-matching type 'long'}} */
41 (double)cf(); /* expected-warning {{cast from function call of type '_Complex double' to non-matching type 'double'}} */
42 (int)ef(); /* expected-warning {{cast from function call of type 'enum e' to non-matching type 'int'}} */
43 (int)bf(); /* expected-warning {{cast from function call of type '_Bool' to non-matching type 'int'}} */
44 (__SIZE_TYPE__
)pf1(); /* expected-warning {{cast from function call of type 'char *' to non-matching type 'unsigned long'}} */
45 (__PTRDIFF_TYPE__
)pf2(); /* expected-warning {{cast from function call of type 'int *' to non-matching type 'long'}} */