568f1428b40bf7c24027e4471bfe72938b139e3c
[platform/upstream/gcc.git] / gcc / testsuite / gcc.dg / dfp / c2x-constexpr-dfp-1.c
1 /* Test C2x constexpr.  Valid code, compilation tests, DFP.  */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c2x -pedantic-errors" } */
4
5 constexpr _Decimal32 v1 = __DEC32_MIN__;
6 constexpr _Decimal32 v2 = __DEC32_SUBNORMAL_MIN__;
7 constexpr _Decimal32 v3 = -__DEC32_MAX__;
8 constexpr _Decimal64 v4 = __DEC32_MIN__;
9 constexpr _Decimal64 v5 = __DEC32_SUBNORMAL_MIN__;
10 constexpr _Decimal64 v6 = -__DEC32_MAX__;
11 constexpr _Decimal64 v7 = __DEC64_MIN__;
12 constexpr _Decimal64 v8 = __DEC64_SUBNORMAL_MIN__;
13 constexpr _Decimal64 v9 = -__DEC64_MAX__;
14 constexpr _Decimal128 v10 = __DEC32_MIN__;
15 constexpr _Decimal128 v11 = __DEC32_SUBNORMAL_MIN__;
16 constexpr _Decimal128 v12 = -__DEC32_MAX__;
17 constexpr _Decimal128 v13 = __DEC64_MIN__;
18 constexpr _Decimal128 v14 = __DEC64_SUBNORMAL_MIN__;
19 constexpr _Decimal128 v15 = -__DEC64_MAX__;
20 constexpr _Decimal128 v16 = __DEC128_MIN__;
21 constexpr _Decimal128 v17 = __DEC128_SUBNORMAL_MIN__;
22 constexpr _Decimal128 v18 = -__DEC128_MAX__;
23 constexpr _Decimal32 v19 = 1234567L;
24 constexpr _Decimal32 v20 = -123456700000LL;
25 constexpr _Decimal64 v21 = 1234567890123456LL;
26 constexpr _Decimal64 v22 = -123456789012345600LL;
27 constexpr _Decimal128 v23 = (unsigned long long) -1;
28 constexpr _Decimal32 v24 = 1e-101DL;
29 constexpr _Decimal64 v25 = 1e-398DL;
30 constexpr _Decimal32 v26 = __builtin_infd128 ();
31 constexpr _Decimal128 v27 = __builtin_infd32 ();
32 constexpr _Decimal64 v28 = __builtin_nand128 ("");
33 constexpr _Decimal128 v29 = __builtin_nand32 ("");
34 constexpr _Decimal32 v30 = __builtin_nansd32 ("");
35 constexpr _Decimal64 v31 = __builtin_nansd64 ("");
36 constexpr _Decimal128 v32 = __builtin_nansd128 ("");
37 constexpr _Decimal32 v33 = {};
38 constexpr _Decimal64 v34 = {};
39 constexpr _Decimal128 v35 = {};
40
41 void
42 f0 ()
43 {
44   (constexpr _Decimal32) { __DEC32_MIN__ };
45   (constexpr _Decimal32) { __DEC32_SUBNORMAL_MIN__ };
46   (constexpr _Decimal32) { -__DEC32_MAX__ };
47   (constexpr _Decimal64) { __DEC32_MIN__ };
48   (constexpr _Decimal64) { __DEC32_SUBNORMAL_MIN__ };
49   (constexpr _Decimal64) { -__DEC32_MAX__ };
50   (constexpr _Decimal64) { __DEC64_MIN__ };
51   (constexpr _Decimal64) { __DEC64_SUBNORMAL_MIN__ };
52   (constexpr _Decimal64) { -__DEC64_MAX__ };
53   (constexpr _Decimal128) { __DEC32_MIN__ };
54   (constexpr _Decimal128) { __DEC32_SUBNORMAL_MIN__ };
55   (constexpr _Decimal128) { -__DEC32_MAX__ };
56   (constexpr _Decimal128) { __DEC64_MIN__ };
57   (constexpr _Decimal128) { __DEC64_SUBNORMAL_MIN__ };
58   (constexpr _Decimal128) { -__DEC64_MAX__ };
59   (constexpr _Decimal128) { __DEC128_MIN__ };
60   (constexpr _Decimal128) { __DEC128_SUBNORMAL_MIN__ };
61   (constexpr _Decimal128) { -__DEC128_MAX__ };
62   (constexpr _Decimal32) { 1234567L };
63   (constexpr _Decimal32) { -123456700000LL };
64   (constexpr _Decimal64) { 1234567890123456LL };
65   (constexpr _Decimal64) { -123456789012345600LL };
66   (constexpr _Decimal128) { (unsigned long long) -1 };
67   (constexpr _Decimal32) { 1e-101DL };
68   (constexpr _Decimal64) { 1e-398DL };
69   (constexpr _Decimal32) { __builtin_infd128 () };
70   (constexpr _Decimal128) { __builtin_infd32 () };
71   (constexpr _Decimal64) { __builtin_nand128 ("") };
72   (constexpr _Decimal128) { __builtin_nand32 ("") };
73   (constexpr _Decimal32) { __builtin_nansd32 ("") };
74   (constexpr _Decimal64) { __builtin_nansd64 ("") };
75   (constexpr _Decimal128) { __builtin_nansd128 ("") };
76   (constexpr _Decimal32) {};
77   (constexpr _Decimal64) {};
78   (constexpr _Decimal128) {};
79 }