<pre><code>struct foo { unsigned x:1; } f;
printf("%d\n", (int)sizeof(f.x = 1));
</code></pre>

<p>What is the expected output and why?  Taking the size of a bitfield lvalue directly isn't allowed. But by using the assignment operator, it seems we can still take the size of a bitfield type.</p>

<p>What is the "size of a bitfield in bytes"?  Is it the size of the storage unit holding the bitfield?  Is it the number of bits taken up by the bf rounded up to the nearest byte count?</p>

<p>Or is the construct undefined behavior because there is nothing in the standard that answers the above questions?  Multiple compilers on the same platform are giving me inconsistent results.</p>

Wouldn't
```
```
(f.x = 1)
```
```
be an expression evaluating to true (technically in evaluates to result of the assignment, which is 1/true in this case), and thus,
```
```
sizeof( f.x = 1)
```
```
is asking for the size of true in terms of how many chars it would take to store it?
I should also add that the Wikipedia article on
sizeof
is nice.  In particular, they say "sizeof is a compile-time operator that returns the size, in multiples of the size of char, of the variable or parenthesized type-specifier that it precedes."
The article also explains that sizeof works on expressions.