summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/huge-val1.C
blob: 2ddfae0c9c6836999d7a7378e11ac14e8a5dcd6a (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
// PR c++/23139: HUGE_VAL definition should be accepted with -pedantic.
// Origin: Joseph Myers <joseph@codesourcery.com>
// { dg-do link }
// { dg-options "-pedantic-errors" }

#include <math.h>

double d = HUGE_VAL;
#ifdef HUGE_VALF
float f = HUGE_VALF;
#endif
#ifdef HUGE_VALL
long double l = HUGE_VALL;
#endif

extern void link_failure ();

int
main ()
{
#ifdef __GLIBC__
  if (HUGE_VAL != __builtin_huge_val ())
    link_failure ();
#ifdef HUGE_VALF
  if (HUGE_VALF != __builtin_huge_valf ())
    link_failure ();
#endif
#ifdef HUGE_VALL
  if (HUGE_VALL != __builtin_huge_vall ())
    link_failure ();
#endif
#endif
}