| 1 |
/* Test C23 digit separators. Valid usages. */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 |
|
| 5 |
_Static_assert (123'45'6 == 123456); |
| 6 |
_Static_assert (0'123 == 0123); |
| 7 |
_Static_assert (0x1'23 == 0x123); |
| 8 |
_Static_assert (0b1'01 == 0b101); |
| 9 |
|
| 10 |
#define m(x) 0 |
| 11 |
|
| 12 |
_Static_assert (m(1'2)+(3'4) == 34); |
| 13 |
|
| 14 |
_Static_assert (0x0'e-0xe == 0); |
| 15 |
|
| 16 |
#define a0 '.' - |
| 17 |
#define acat(x) a ## x |
| 18 |
_Static_assert (acat (0'.') == 0); |
| 19 |
|
| 20 |
#define c0(x) 0 |
| 21 |
#define b0 c0 ( |
| 22 |
#define bcat(x) b ## x |
| 23 |
_Static_assert (bcat (0'\u00c0')) == 0); |
| 24 |
|
| 25 |
extern void exit (int); |
| 26 |
extern void abort (void); |
| 27 |
|
| 28 |
int |
| 29 |
main (void) |
| 30 |
{ |
| 31 |
if (314'159e-0'5f != 3.14159f) |
| 32 |
abort (); |
| 33 |
exit (0); |
| 34 |
} |
| 35 |
|
| 36 |
#line 0'123 |
| 37 |
_Static_assert (__LINE__ == 123); |
| 38 |
|
| 39 |
#line 4'56'7'8'9 |
| 40 |
_Static_assert (__LINE__ == 456789); |