https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109532

--- Comment #5 from Wilhelm M <klaus.doldinger64 at googlemail dot com> ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Wilhelm M from comment #3)
> > Isn't this a case where the as-if rule kicks in?
> 
> What rule is that? Scopped enums are different from unscopped ones here
> specifically as defined in the C++ standard.

Ok, I see the point as the C++ standard nails down the type to int disallowing
any as-if optimization.

So in general a scoped-enum inside a class (nested type) maybe always a bad
idea, because it prevents optimization. And when specifying the underlying
type, the -fstrict-enums can't be applied because all values of the underlying
type are possible.

Reply via email to