The following program
struct X { unsigned n : 1; };
int main() { struct X x; typeof(x.n) tmp = 0; return tmp; }
compiles without error in 3.x, both as C and as C++.  In 4.0 it still compiles 
without error as C++, but 
no longer as C.  Nothing in the documentation for typeof 
(http://gcc.gnu.org/onlinedocs/gcc/
Typeof.html#Typeof) suggests that typeof behaves differently in C and in C++, 
or that there is a 
restriction on its use with bitfields.

This may be indirectly related to standard conformance issues, but the relation 
can't be very direct; 
typeof is a GNU extension, so any documented and consistent behavior is 
correct. 

We should either change the documenation to say that typeof no longer works 
with bitfields in C, or 
make it work again.

-- 
           Summary: typeof no longer works for bitfields
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: austern at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: all
  GCC host triplet: all
GCC target triplet: all


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

Reply via email to