Test case:
#include
#define INT_INVALID -1
class Test
{
int b : 16;
int a;
int c : 16;
public:
Test()
{
b = a = c = INT_INVALID;
//a = b = c = INT_INVALID;
}
void dump()const
{
printf("a: %d\tb: %d\tc: %d\n",a,b,c);
}
};
int main()
{
Test a;
a.dump();
return 0;
}
g++-4.1 main.cpp
./a.out
a: 65535b: -1 c: -1
g++-4.0 main.cpp
a: -1 b: -1 c: -1
It seems like regression in GCC-4.1.1 and 4.1.2(on GCC-4.1.0 and earlier
I've got correct results)
--
Summary: problem with bit-fields assignment
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vovanec at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30763