https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87037
Bug ID: 87037 Summary: vector :: erase return value should be marked "must use" Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Target Milestone: --- Given the following C++ source code # include <vector> using namespace std; void f( vector < int > & vec) { for (auto i = vec.begin(); i != vec.end(); ++i) { vec.erase( i); } } then there is an obvious bug that the return value from the erase isn't used for loop control. gcc seems strangely silent on the issue: $ ~/gcc/results.263644/bin/gcc -c -g -O2 -Wall -Wextra aug21a.cc $