1 // RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wbad-function-cast -ffixed-point -triple x86_64-unknown-unknown -verify
9 _Complex
double cf(void);
10 enum e
{ E1
} ef(void);
20 /* default, no cast, should always be ok */
22 /* Casts to void types are always OK. */
28 /* Casts to the same type or similar types are OK. */
40 /* All following casts issue warning */
41 (float)if1(); /* expected-warning {{cast from function call of type 'int' to non-matching type 'float'}} */
42 (double)if2(); /* expected-warning {{cast from function call of type 'char' to non-matching type 'double'}} */
43 (_Bool
)if3(); /* expected-warning {{cast from function call of type 'long' to non-matching type '_Bool'}} */
44 (int)rf1(); /* expected-warning {{cast from function call of type 'float' to non-matching type 'int'}} */
45 (long)rf2(); /* expected-warning {{cast from function call of type 'double' to non-matching type 'long'}} */
46 (double)cf(); /* expected-warning {{cast from function call of type '_Complex double' to non-matching type 'double'}} */
47 (int)ef(); /* expected-warning {{cast from function call of type 'enum e' to non-matching type 'int'}} */
48 (int)bf(); /* expected-warning {{cast from function call of type '_Bool' to non-matching type 'int'}} */
49 (__SIZE_TYPE__
)pf1(); /* expected-warning {{cast from function call of type 'char *' to non-matching type 'unsigned long'}} */
50 (__PTRDIFF_TYPE__
)pf2(); /* expected-warning {{cast from function call of type 'int *' to non-matching type 'long'}} */
51 (_Fract
) if1(); /* expected-warning{{cast from function call of type 'int' to non-matching type '_Fract'}} */
52 (int)ff1(); /* expected-warning{{cast from function call of type '_Fract' to non-matching type 'int'}} */