| 1 |
/* Test C23 typeof and typeof_unqual. Invalid code. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 |
|
| 5 |
struct s { int i : 2; } x; |
| 6 |
union u { unsigned int j : 1; } y; |
| 7 |
|
| 8 |
typeof (x.i) j; /* { dg-error "applied to a bit-field" } */ |
| 9 |
typeof_unqual (x.i) j2; /* { dg-error "applied to a bit-field" } */ |
| 10 |
typeof (y.j) j3; /* { dg-error "applied to a bit-field" } */ |
| 11 |
typeof_unqual (y.j) j4; /* { dg-error "applied to a bit-field" } */ |
| 12 |
|
| 13 |
static int ok (void); |
| 14 |
static int also_ok (void); |
| 15 |
static int not_defined (void); /* { dg-error "used but never defined" } */ |
| 16 |
static int also_not_defined (void); /* { dg-error "used but never defined" } */ |
| 17 |
|
| 18 |
void |
| 19 |
f (void) |
| 20 |
{ |
| 21 |
typeof (ok ()) x = 2; |
| 22 |
typeof_unqual (also_ok ()) y = 2; |
| 23 |
int a[2]; |
| 24 |
int (*p)[x] = &a; |
| 25 |
typeof (p + not_defined ()) q; |
| 26 |
typeof_unqual (p + also_not_defined ()) q2; |
| 27 |
} |