(C++) 0-width bitfields, take 3

Jason Merrill jason@cygnus.com
Mon Nov 23 23:05:00 GMT 1998


And the corner cases keep popping out...

1998-11-23  Jason Merrill  <jason@yorick.cygnus.com>

	* class.c (finish_struct_1): A class with a 0-width bitfield is
	still empty.

Index: class.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/class.c,v
retrieving revision 1.111
diff -c -p -r1.111 class.c
*** class.c	1998/11/23 03:12:05	1.111
--- class.c	1998/11/24 07:04:01
*************** finish_struct_1 (t, warn_anon)
*** 3453,3459 ****
        if (TREE_CODE (x) == FIELD_DECL)
  	{
  	  DECL_PACKED (x) |= TYPE_PACKED (t);
! 	  empty = 0;
  	}
  
        if (TREE_CODE (x) == USING_DECL)
--- 3453,3463 ----
        if (TREE_CODE (x) == FIELD_DECL)
  	{
  	  DECL_PACKED (x) |= TYPE_PACKED (t);
! 
! 	  if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x)))
! 	    /* A zero-width bitfield doesn't do the trick.  */;
! 	  else
! 	    empty = 0;
  	}
  
        if (TREE_CODE (x) == USING_DECL)



More information about the Gcc-patches mailing list