------- Comment #4 from tydeman at tybor dot com  2009-02-04 16:16 -------
/*
 * _Bool bit-fields: C99: 6.7.2.1, paragraph 3 along with Defect Report 335.
 * _Bool bit-fields of size up to CHAR_BIT must be supported.
 */
#include <limits.h>             /* CHAR_BIT */

int main(void){
  struct bits {
   int        : 0;
   _Bool      : 0;              /* force alignment */
   _Bool bbf1 : 1;              /* holds values 0 and 1 */ 
   _Bool bbf8 : CHAR_BIT;       /* must be supported */
  } bits;
  return 0;
}

The above code fails to compile in gcc 4.3.2-7
The error message is:
error: width of 'bbf8' exceeds its type

A _Bool is one storage unit, so is CHAR_BIT bits.
Therefore, _Bool bit-fields of size 0, 1, 2, ... CHAR_BIT
must be supported.


-- 

tydeman at tybor dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tydeman at tybor dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19618

Reply via email to