gcc/testsuite/gcc.dg/c23-tag-composite-9.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-std=c23 -Wc++-compat" } */ |
| 3 | |
| 4 | // test that DECL_BIT_FIELD_TYPE is set correctly |
| 5 | |
| 6 | enum e { A, B, C }; |
| 7 | struct s { enum e m : 3; char (*y)[]; } s = { }; |
| 8 | |
| 9 | void f(enum e); |
| 10 | |
| 11 | void foo () |
| 12 | { |
| 13 | struct s { enum e m : 3; char (*y)[1]; } t = { }; |
| 14 | f(s.m); |
| 15 | f(t.m); |
| 16 | typeof(*(1 ? &s : &t)) u = { }; |
| 17 | f(u.m); // should not warn |
| 18 | } |
| 19 |