aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c23-digit-separators-1.c
blob: 4b5f4f6951d85bc27d7763a38172a991af375a61 (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
34
35
36
37
38
39
/* Test C23 digit separators.  Valid usages.  */
/* { dg-do run } */
/* { dg-options "-std=c23 -pedantic-errors" } */

_Static_assert (123'45'6 == 123456);
_Static_assert (0'123 == 0123);
_Static_assert (0x1'23 == 0x123);

#define m(x) 0

_Static_assert (m(1'2)+(3'4) == 34);

_Static_assert (0x0'e-0xe == 0);

#define a0 '.' -
#define acat(x) a ## x
_Static_assert (acat (0'.') == 0);

#define c0(x) 0
#define b0 c0 (
#define bcat(x) b ## x
_Static_assert (bcat (0'\u00c0')) == 0);

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

int
main (void)
{
  if (314'159e-0'5f != 3.14159f)
    abort ();
  exit (0);
}

#line 0'123
_Static_assert (__LINE__ == 123);

#line 4'56'7'8'9
_Static_assert (__LINE__ == 456789);