Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / dfp / pragma-float-const-decimal64-7.c
blob55e0d661c038c1546ebd0a3d03c7c7245ef7e556
1 /* { dg-do compile } */
2 /* { dg-options "-Wall" } */
4 /* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
5 C99 6.4.4.2a (New).
7 Check that when pragma FLOAT_CONST_DECIMAL64 is in effect so that
8 unsuffixed constants are _Decimal64, invalid types are still reported
9 as invalid. */
11 double
12 f1 (void)
14 #pragma STDC FLOAT_CONST_DECIMAL64 OFF
15 double a = 0x1.0p1;
16 double b = 1.0i;
18 return a + b;
21 double
22 f2 (void)
24 #pragma STDC FLOAT_CONST_DECIMAL64 OFF
25 double a = 0x1.0p1dd; /* { dg-error "with hex" } */
26 double b = 1.0idd; /* { dg-error "invalid suffix" } */
28 return a + b;
31 double
32 f3 (void)
34 #pragma STDC FLOAT_CONST_DECIMAL64 ON
35 double a = 0x1.0p1; /* Hex constant is not affected by pragma. */
36 double b = 1.0i; /* Imaginary constant is not affected by pragma. */
38 return a + b;