https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88086
Gábor Buella changed:
What|Removed |Added
CC||gbuella at gmail dot com
--- Comment #1
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gbuella at gmail dot com
Target Milestone: ---
$ cat code.cc
enum some_enum { x = 1000 };
void sink(some_enum);
void func()
{
for (int i = 0; i < 3; ++i) {
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #2 from Gábor Buella ---
(In reply to Andrew Pinski from comment #1)
> -fstrict-enums
> Allow the compiler to optimize using the assumption that a value of
> enumerated type can only be one of the values of the enumeration (as defined
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #3 from Gábor Buella ---
In case anyone would still get confused about the what values get casted to
enum, here is another way to write that example:
enum some_enum { x0, x1, x2, x3, x4, x5, x6, x7,
x8, x9,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #6 from Gábor Buella ---
(In reply to Jonathan Wakely from comment #4)
> I can't reproduce this with GCC 9, only 8.
$ cat code.cc
enum some_enum { x = 1000 };
void sink(some_enum);
void func()
{
for (int i = 0; i < 3; ++i)