aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c2x-bool-limits-1.c
blob: 53431132e07e87ff236072da4b4431e638aa3520 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* Test limits for _Bool in <limits.h> in C23.  */
/* { dg-do compile } */
/* { dg-options "-std=c23" } */

#include <limits.h>

#ifndef BOOL_MAX
# error "missing BOOL_MAX"
#endif

#ifndef BOOL_WIDTH
# error "missing BOOL_WIDTH"
#endif

/* In principle _Bool can support values wider than 1 bit, stored via
   type punning, but this is not supported by GCC.  */

_Static_assert (BOOL_MAX == 1, "bad BOOL_MAX");
_Static_assert (BOOL_WIDTH == 1, "bad BOOL_WIDTH");