1 /* { dg-do compile } */
2 
3 /* C99 6.5.4 Cast operators.
4    Test invalid casts involving decimal float.  */
5 
6 struct s { _Decimal32 d32; } sv;
7 union u { _Decimal32 d32; } uv;
8 
9 _Decimal32 d32;
10 _Decimal64 d64;
11 _Decimal128 d128;
12 
13 _Decimal32* d32p;
14 _Decimal64* d64p;
15 _Decimal128* d128p;
16 
17 void
f(void)18 f (void)
19 {
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" } */
26 
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" } */
33 
34   (_Decimal32) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */
35   (_Decimal32) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */
36   (_Decimal64) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */
37   (_Decimal64) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */
38   (_Decimal128) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */
39   (_Decimal128) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */
40 }
41