I'm using the Boost Unit Test Framework and have a struct with bitfields declared in it.

When I compile a unit test with code like this

  StructWithBitfields mystruct;
  StructWithBitfields otherstruct;

  BOOST_CHECK_EQUAL(mystruct.bitfield, otherstruct.bitfield);

I get a compiler errors

error: non-const reference cannot bind to bit-field 'bitfield'

referring to both arguments to the macro.

Is there a preferred way for comparing bitfield values via unit test macros?


--
Chris Cleeland