https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89450
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Martin Liška from comment #0) > Issues is that: > > 14746 /* If -fstrict-enums, still constrain TYPE_MIN/MAX_VALUE. */ > 14747 if (flag_strict_enums) > 14748 set_min_and_max_values_for_integral_type (enumtype, > precision, sgn); > > is called for precision, which sets min = 0 and max = 7. Because that's how enums work in C++, as required by the standard. That's not an issue. > What about doing: > > diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c > index 612afbacd27..46302b4a61d 100644 > --- a/gcc/cp/decl.c > +++ b/gcc/cp/decl.c > @@ -14745,7 +14745,10 @@ finish_enum_value_list (tree enumtype) > > /* If -fstrict-enums, still constrain TYPE_MIN/MAX_VALUE. */ > if (flag_strict_enums) > - set_min_and_max_values_for_integral_type (enumtype, precision, sgn); > + { > + TYPE_MIN_VALUE (enumtype) = minnode; > + TYPE_MAX_VALUE (enumtype) = maxnode; > + } > } > else > underlying_type = ENUM_UNDERLYING_TYPE (enumtype); > > I can also imagine another option level when desired. Please no. -fstrict-enums currently makes the compiler *more* strictly conforming, by following the rules of the standard. Your suggestion arguably makes it *less* conforming, by deciding that valid values should emit a warning. What you want is not how enums work in C++. Please don't abuse -fstrict-enums when what you want is "some other kind of enum, not one that strictly follows the C++ standard".