blob: 55e0d661c038c1546ebd0a3d03c7c7245ef7e556 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* { dg-do compile } */
/* { dg-options "-Wall" } */
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
C99 6.4.4.2a (New).
Check that when pragma FLOAT_CONST_DECIMAL64 is in effect so that
unsuffixed constants are _Decimal64, invalid types are still reported
as invalid. */
double
f1 (void)
{
#pragma STDC FLOAT_CONST_DECIMAL64 OFF
double a = 0x1.0p1;
double b = 1.0i;
return a + b;
}
double
f2 (void)
{
#pragma STDC FLOAT_CONST_DECIMAL64 OFF
double a = 0x1.0p1dd; /* { dg-error "with hex" } */
double b = 1.0idd; /* { dg-error "invalid suffix" } */
return a + b;
}
double
f3 (void)
{
#pragma STDC FLOAT_CONST_DECIMAL64 ON
double a = 0x1.0p1; /* Hex constant is not affected by pragma. */
double b = 1.0i; /* Imaginary constant is not affected by pragma. */
return a + b;
}
|