Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 1.3.85 (2.0.0-rc1)
-
None
Description
I use the following union type (TTestUnion0) often to access the single bits of a byte. In this case, code completion doesn't work correctly, it shows all fields (Bit0, Bit1, Bit2, Bit3, Rest, Bit, Byte) in a flat hierarchy (see attachment).
However, if I define the Bitfield on it's own (TTestStruct) and use it in a union (TTestUnion1), everything is fine.
typedef union {
struct
Bit;
char Byte;
} TTestUnion0;
typedef struct {
char Bit0: 1;
char Bit1: 1;
char Bit2: 1;
char Bit3: 1;
char Rest: 4;
} TTestStruct;
typedef union {
TTestStruct Bit;
char Byte;
} TTestUnion1;
void test()
{
TTestUnion0 u0;
TTestUnion1 u1;
// completion doesn't work correctly
u0.Bit0 = 1;
// completion works!
u1.Bit.Bit0 = 0;
u1.Bit.Rest = 4;
}
It would be very nice, if this could be improved!