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

            Bug ID: 91819
           Summary: ICE when iterating over enum values
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: moritz.kreutzer at siemens dot com
  Target Milestone: ---

Created attachment 46899
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46899&action=edit
Preprocessed source and backtrace

Hi,

we are getting an ICE with the latest trunk of GCC with the following code:

====================================
enum Foo
{
  a,
  b
};

inline Foo operator++(Foo &f, int) 
{
  return f = (Foo)(f + 1);
}

int main()
{
  int count = 0;
  for (Foo f = a; f <= b; f++) {
    count++;
  }
  return count;
}
====================================

GCC 9 and older seem to be working: https://godbolt.org/z/UO37hz

The preprocessed source and backtrace are attached. Let me know if you need
further information.


Thanks,
Moritz

Reply via email to