As this is type-safe, shouldn't we also be ensuring that the flag being set is indeed only one flag, and that that flag is a valid value for the enum?