[Bug c++/87481] Endless loop with optimisation in C++17

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 1 14:18:00 GMT 2018


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |compile-time-hog
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-10-01
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

struct thread {
  template<typename F> thread(F) { }
};

template<typename D>
void sleep_for(D) { }

template<typename T> struct duration { };
using milliseconds = duration<int>;

void f()
{
  thread sleeper([]{
    while (true) {
      for (unsigned cc = 0; cc < 10000; ++cc) ;
      sleep_for(millliseconds(50));
    }
  });
}


More information about the Gcc-bugs mailing list