Debian Codegraph @

gcc/testsuite/g++.dg/warn/huge-val1.C

raw
1 // PR c++/23139: HUGE_VAL definition should be accepted with -pedantic.
2 // Origin: Joseph Myers <[email protected]>
3 // { dg-do link }
4 // { dg-options "-pedantic-errors" }
5 // { dg-skip-if "requires hosted libstdc++ for cmath" { ! hostedlib } }
6
7 #include <math.h>
8
9 double d = HUGE_VAL;
10 #ifdef HUGE_VALF
11 float f = HUGE_VALF;
12 #endif
13 #ifdef HUGE_VALL
14 long double l = HUGE_VALL;
15 #endif
16
17 extern void link_failure ();
18
19 int
20 main ()
21 {
22 #ifdef __GLIBC__
23 if (HUGE_VAL != __builtin_huge_val ())
24 link_failure ();
25 #ifdef HUGE_VALF
26 if (HUGE_VALF != __builtin_huge_valf ())
27 link_failure ();
28 #endif
29 #ifdef HUGE_VALL
30 if (HUGE_VALL != __builtin_huge_vall ())
31 link_failure ();
32 #endif
33 #endif
34 }