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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-15

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This terminates with an exception, but I think it's valid.

#include <algorithm>

const int global = 0;

struct X {
  void operator=(const int& i) { if (&i != &global) throw 1; }
};

int main()
{
  X x;
  std::fill(&x, &x+1, global);
}

So I think the std::fill (and std::fill_n) optimizations need to consider the
iterator's value type as well as the _Tp type.

Reply via email to