diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/bitfld-12.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/bitfld-12.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/bitfld-12.c b/gcc/testsuite/gcc.dg/bitfld-12.c new file mode 100644 index 0000000..8b2b659 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitfld-12.c @@ -0,0 +1,12 @@ +/* Test for rejection of taking address of bit-fields. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#include <stddef.h> + +struct s { int a : 1; } x, *y; + +int a = offsetof (struct s, a); /* { dg-error "error: attempt to take address of bit-field structure member 'a'" } */ +void *b = &x.a; /* { dg-error "error: cannot take address of bit-field 'a'" } */ +void *c = &y->a; /* { dg-error "error: cannot take address of bit-field 'a'" } */ |