When specifying the whole flag list in one assignment, do a compile time check using the template parameter. When modifying a runtime-written flag list, do a runtime check on the final flag variable using the function parameter.