Fix gcc warning: enumeral and non-enumeral type in conditional expression