https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91620
Bug ID: 91620 Summary: [forward_]list::remove_if should respect to DR 529 Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: frankhb1989 at gmail dot com Target Milestone: --- A case for std::list taken from libc++'s testsuite: #include <cstddef> #include <cassert> #include <functional> #include <list> using namespace std; struct PredLWG529 { PredLWG529(int i) : i_(i) {}; ~PredLWG529() { i_ = -32767; } bool operator() (const PredLWG529& p) const { return p.i_ == i_; } bool operator==(int i) const { return i == i_; } int i_; }; int main() { int a1[] = {1, 2, 1, 3, 5, 8, 11}; int a2[] = {2, 3, 5, 8, 11}; std::list<PredLWG529> c(a1, a1 + 7); c.remove_if(std::ref(c.front())); assert(c.size() == 5); for(size_t i = 0; i < c.size(); ++i) { assert(c.front() == a2[i]); c.pop_front(); } }