The compiler sees the binary operator &in your expression if, treats it as a logical AND (since it expects an expression that returns boolean), and checks the types of arguments.
int - combined - boolean - flag1 == flag1. boolean ( & int a boolean), .
, :
if ((combined & flag1 ) == flag1)