On 17 September 2014 17:16, Andy Falanga (afalanga) wrote: > Flag operator &=(Flag& f1, Flag f2) { > return static_cast<Flag>(reinterpret_cast<unsigned int&>(f1) &= static_cast<unsigned int>(f2)); > } That reinterpret_cast looks dodgy to me, accessing the object through a different type is undefined behaviour. What's wrong with doing it safely? Flag operator &=(Flag& f1, Flag f2) { unsigned int i = f1; i &= static_cast<unsigned int>(f2); return f1 = static_cast<Flag>(i); }