aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/bitint-19.c
blob: 665a08187f60bc3fb2fabfcdc91c04ffb887059d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* PR c/102989 */
/* { dg-do compile { target bitint } } */
/* { dg-options "-std=gnu23" } */

#define expr_has_type(e, t) _Generic (e, default : 0, t : 1)

void
foo (_Complex int ci, _Complex long long cl)
{
  _BitInt(__SIZEOF_INT__ * __CHAR_BIT__ - 1) bi = 0wb;
  _BitInt(__SIZEOF_LONG_LONG__ * __CHAR_BIT__ - 1) bl = 0wb;
  static_assert (expr_has_type (ci + bi, _Complex int));
  static_assert (expr_has_type (cl + bl, _Complex long long));
  static_assert (expr_has_type (bi + ci, _Complex int));
  static_assert (expr_has_type (bl + cl, _Complex long long));
}