]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/c2x-typeof-2.c
1 /* Test C2x typeof and typeof_unqual. Invalid code. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c2x -pedantic-errors" } */
5 struct s
{ int i
: 2; } x
;
6 union u
{ unsigned int j
: 1; } y
;
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" } */
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" } */
22 typeof_unqual (also_ok ()) y
= 2;
25 typeof (p
+ not_defined ()) q
;
26 typeof_unqual (p
+ also_not_defined ()) q2
;