gcc/testsuite/gcc.dg/bitfld-22.c
raw| 1 | /* PR c/70671 */ |
| 2 | /* { dg-do compile } */ |
| 3 | |
| 4 | extern void bar (int *); |
| 5 | |
| 6 | struct S |
| 7 | { |
| 8 | int x:2; |
| 9 | } s, *r; |
| 10 | |
| 11 | void |
| 12 | foo (void) |
| 13 | { |
| 14 | int *p1 = &s.x; /* { dg-error "13:cannot take address of bit-field 'x'" } */ |
| 15 | int *p2; |
| 16 | p2 = &s.x; /* { dg-error "8:cannot take address of bit-field 'x'" } */ |
| 17 | bar (&s.x); /* { dg-error "8:cannot take address of bit-field 'x'" } */ |
| 18 | } |