I have a struct containing a single bitfield, and I get a warning "<bits.0> may be used before being set" when the struct is instantiated. (Actually I don't get that warning at all, I'll add another post about the incorrect warning in a second)
Here's the simplest repro step I've found:
struct Bitfield
{
unsigned char bit1:1;
};
Bitfield Test()
{
Bitfield bits; // "<bits.0> may be used before being set"
bits.bit1 = 1;
return bits;
}
It's not a huge deal, as it is only a warning, but I'm so used to always building with -wall it bugs me :)
It doesn't actually matter if I have a constructor or not, this example behaves identically:
struct Bitfield2
{
Bitfield2()
{
bit1 = 0;
}
unsigned char bit1:1;
};
Bitfield2 Test2()
{
Bitfield2 bits; // "<bits.0> may be used before being set"
bits.bit1 = 1;
return bits;
}
I have a struct containing a single bitfield, and I get a warning "<bits.0> may be used before being set" when the struct is instantiated. (Actually I don't get that warning at all, I'll add another post about the incorrect warning in a second)
Here's the simplest repro step I've found:
It's not a huge deal, as it is only a warning, but I'm so used to always building with -wall it bugs me :)
It doesn't actually matter if I have a constructor or not, this example behaves identically: