aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c2x-float-2.c
blob: 4f669fd39bccf3cd45f1ef825abd6f5d19001755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Test INFINITY macro.  Generic test even if infinities not
   supported.  */
/* { dg-do run } */
/* { dg-options "-std=c2x -w" } */
/* { dg-add-options ieee } */

#include <float.h>

#ifndef INFINITY
#error "INFINITY undefined"
#endif

extern void abort (void);
extern void exit (int);

int
main (void)
{
  (void) _Generic (INFINITY, float : 0);
  if (!(INFINITY >= FLT_MAX))
    abort ();
  exit (0);
}