1 /* Test operation of -Wbad-function-cast. */
2 /* Based on gcc.dg/Wbad-function-cast-1.c. */
4 /* { dg-do compile } */
5 /* { dg-options "-Wbad-function-cast" } */
14 _Decimal128
rf5(void);
15 _Complex
double cf(void);
20 /* Casts to void types are always OK. */
25 /* Casts to the same type or similar types are OK. */
34 /* Casts to types with different TREE_CODE (which is how this
35 warning has been defined) are not OK, except for casts to void
37 (_Decimal32
)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Decimal32'" } */
38 (_Decimal64
)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Decimal64'" } */
39 (_Decimal128
)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Decimal128'" } */
40 (int)rf3(); /* { dg-warning "cast from function call of type '_Decimal32' to non-matching type 'int'" } */
41 (long)rf4(); /* { dg-warning "cast from function call of type '_Decimal64' to non-matching type 'long int'" } */
42 (long int)rf5(); /* { dg-warning "cast from function call of type '_Decimal128' to non-matching type 'long int'" } */
43 (_Decimal32
)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Decimal32'" } */