1 /* { dg-do compile } */
2
3 /* N1150 5.4: Usual arithmetic conversions.
4 C99 6.3.1.8[1] (New).
5
6 Test arithmetic operators between decimal float types and generic
7 float types, which are not allowed. */
8
9 extern _Decimal32 d32a, d32b;
10 extern _Decimal64 d64a, d64b;
11 extern _Decimal128 d128a, d128b;
12 extern float f;
13 extern double d;
14 extern long double ld;
15
16 extern signed int __attribute__ ((vector_size (16))) vi;
17
18 extern _Complex float cf;
19 extern _Complex double cd;
20 extern _Complex long double cld;
21 extern _Complex int ci;
22
23 void
foo(void)24 foo (void)
25 {
26 /* Mixed operations with decimal and generic float operands. */
27 d32a = d32b + f; /* { dg-error "" "error.*mix operands of decimal float" } */
28 d32a = f * d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
29 d32a *= f; /* { dg-error "" "error.* mix operands of decimal float" } */
30 f += d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
31 d64a = d32a + d; /* { dg-error "" "error.* mix operands of decimal float" } */
32 d64a = d * d128a; /* { dg-error "" "error.* mix operands of decimal float" } */
33 d64a -= d; /* { dg-error "" "error.* mix operands of decimal float" } */
34 d128a = ld * d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
35 d128a = d64b + d; /* { dg-error "" "error.* mix operands of decimal float" } */
36 d128a *= f; /* { dg-error "" "error.* mix operands of decimal float" } */
37
38 /* Mixed operations with decimal float and a vector type. */
39 d64a = d64b + vi; /* { dg-error "" "error.* mix operands of decimal float" } */
40 d32a *= vi; /* { dg-error "" "error.* mix operands of decimal float" } */
41 d128a = vi - d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
42
43 /* Mixed operations with decimal float and Complex types. */
44 d32a += ci; /* { dg-error "" "error.* mix operands of decimal float" } */
45 d64a = ci * d32a; /* { dg-error "" "error.* mix operands of decimal float" } */
46 cd = d64a * cd; /* { dg-error "" "error.* mix operands of decimal float" } */
47 d128b = cld * d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
48 d32a = cf * d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
49 }
50