diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-29 20:09:48 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-29 20:09:48 +0000 |
commit | d51ca159d6978fd57fd4fed8a682a3524ae1fd0a (patch) | |
tree | 4d419d4608db09c9377ca886e7a0f46230ca3c66 /gcc | |
parent | 875abd36c5eb803220e5128d9e6bafd1a83bd5c1 (diff) | |
download | gcc-d51ca159d6978fd57fd4fed8a682a3524ae1fd0a.tar.gz |
PR c/10333
* c-parse.in (typespec_reserved_nonattr): Reject typeof on
bit-fields.
testsuite:
* gcc.dg/bitfld-7.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74036 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-parse.in | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/bitfld-7.c | 8 |
4 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2fc72f917d0..3174814e16f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-11-29 Joseph S. Myers <jsm@polyomino.org.uk> + + PR c/10333 + * c-parse.in (typespec_reserved_nonattr): Reject typeof on + bit-fields. + 2003-11-29 Richard Sandiford <rsandifo@redhat.com> * stmt.c (expand_asm_operands): Check whether force_const_mem diff --git a/gcc/c-parse.in b/gcc/c-parse.in index d58b1ef6bbe..9a18d340737 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1375,7 +1375,11 @@ typespec_nonreserved_nonattr: { $$ = get_object_reference ($1); } @@end_ifobjc | typeof '(' expr ')' - { skip_evaluation--; $$ = TREE_TYPE ($3); } + { skip_evaluation--; + if (TREE_CODE ($3) == COMPONENT_REF + && DECL_C_BIT_FIELD (TREE_OPERAND ($3, 1))) + error ("`typeof' applied to a bit-field"); + $$ = TREE_TYPE ($3); } | typeof '(' typename ')' { skip_evaluation--; $$ = groktypename ($3); } ; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ef9814b5ae..8a5b62a552f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-11-29 Joseph S. Myers <jsm@polyomino.org.uk> + + PR c/10333 + * gcc.dg/bitfld-7.c: New test. + 2003-11-29 Richard Sandiford <rsandifo@redhat.com> * gcc.dg/tls/asm-1.C: New test. diff --git a/gcc/testsuite/gcc.dg/bitfld-7.c b/gcc/testsuite/gcc.dg/bitfld-7.c new file mode 100644 index 00000000000..70004ffd8cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitfld-7.c @@ -0,0 +1,8 @@ +/* Test for rejection of typeof on bit-fields. PR c/10333. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct { int a:1; } x; + +typeof (x.a) z; /* { dg-error "applied to a bit-field" "typeof" } */ |