Commit 65f0edec by Joseph Myers Committed by Joseph Myers

re PR c/10333 (typeof (bitfield) is accepted but doesn't work)

	PR c/10333
	* c-parse.in (typespec_reserved_nonattr): Reject typeof on
	bit-fields.

testsuite:
	* gcc.dg/bitfld-7.c: New test.

From-SVN: r74036
parent 9c858681
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> 2003-11-29 Richard Sandiford <rsandifo@redhat.com>
* stmt.c (expand_asm_operands): Check whether force_const_mem * stmt.c (expand_asm_operands): Check whether force_const_mem
......
...@@ -1375,7 +1375,11 @@ typespec_nonreserved_nonattr: ...@@ -1375,7 +1375,11 @@ typespec_nonreserved_nonattr:
{ $$ = get_object_reference ($1); } { $$ = get_object_reference ($1); }
@@end_ifobjc @@end_ifobjc
| typeof '(' expr ')' | 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 ')' | typeof '(' typename ')'
{ skip_evaluation--; $$ = groktypename ($3); } { skip_evaluation--; $$ = groktypename ($3); }
; ;
......
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> 2003-11-29 Richard Sandiford <rsandifo@redhat.com>
* gcc.dg/tls/asm-1.C: New test. * gcc.dg/tls/asm-1.C: New test.
......
/* 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" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment