Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / dfp / cast-bad.c
blobe9e31ff306763037b10ebb0cd4b21d5c3bd8cee7
1 /* { dg-do compile } */
3 /* C99 6.5.4 Cast operators.
4 Test invalid casts involving decimal float. */
6 struct s { _Decimal32 d32; } sv;
7 union u { _Decimal32 d32; } uv;
9 _Decimal32 d32;
10 _Decimal64 d64;
11 _Decimal128 d128;
13 _Decimal32* d32p;
14 _Decimal64* d64p;
15 _Decimal128* d128p;
17 void
18 f (void)
20 (_Decimal32 []) d32p; /* { dg-error "cast specifies array type" } */
21 (_Decimal32 ()) d32p; /* { dg-error "cast specifies function type" } */
22 (_Decimal64 []) d64p; /* { dg-error "cast specifies array type" } */
23 (_Decimal64 ()) d64p; /* { dg-error "cast specifies function type" } */
24 (_Decimal128 []) d128p; /* { dg-error "cast specifies array type" } */
25 (_Decimal128 ()) d128p; /* { dg-error "cast specifies function type" } */
27 (struct s) d32; /* { dg-error "conversion to non-scalar type requested" } */
28 (union u) d32;
29 (struct s) d64; /* { dg-error "conversion to non-scalar type requested" } */
30 (union u) d64; /* { dg-error "cast to union type from type not present in union" } */
31 (struct s) d128; /* { dg-error "conversion to non-scalar type requested" } */
32 (union u) d128; /* { dg-error "cast to union type from type not present in union" } */
34 (_Decimal32) sv; /* { dg-error "aggregate value used where a float was expected" } */
35 (_Decimal32) uv; /* { dg-error "aggregate value used where a float was expected" } */
36 (_Decimal64) sv; /* { dg-error "aggregate value used where a float was expected" } */
37 (_Decimal64) uv; /* { dg-error "aggregate value used where a float was expected" } */
38 (_Decimal128) sv; /* { dg-error "aggregate value used where a float was expected" } */
39 (_Decimal128) uv; /* { dg-error "aggregate value used where a float was expected" } */