diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-20 01:52:35 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-20 01:52:35 +0000 |
commit | aaceaa0f0578483b127c56992aa95d23561a078c (patch) | |
tree | 574e34ee47b0d94b71393462d7e047501eb6adfc /gcc/testsuite/gcc.dg/bitfld-14.c | |
parent | efa312e63dbcd87973d1992d9223514e1e825727 (diff) | |
download | gcc-aaceaa0f0578483b127c56992aa95d23561a078c.tar.gz |
* c-decl.c (check_bitfield_type_and_width): Require bit-field
width to have integer type.
(build_enumerator): Require enumerator value to have integer type.
testsuite:
* gcc.dg/bitfld-14.c, gcc.dg/enum3.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96755 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/bitfld-14.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/bitfld-14.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/bitfld-14.c b/gcc/testsuite/gcc.dg/bitfld-14.c new file mode 100644 index 00000000000..eca0b03def0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitfld-14.c @@ -0,0 +1,11 @@ +/* Test for non-integer bit-field widths. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { E, F }; +struct s { + int a : (void *)4; /* { dg-error "error: bit-field 'a' width not an integer constant" } */ + int b : (enum e)F; + int c : (_Bool)1; +}; |