https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86516
--- Comment #2 from Paul Gotch <paulg at chiark dot greenend.org.uk> --- I can reproduce this at will with GCC 7.3 it does not reproduce with GCC 8 // Compile with g++ -c -Wextra -Wall -Werror -O3 test.cpp #include <vector> class Foo { public: Foo() {} virtual ~Foo() { } // warning only reproduces if this calls inner and is virtual virtual void outer() { inner(); } void inner() { while ( ! vInt.empty() ) { vInt.resize( vInt.size() - 1 ); } } std::vector<int*> vInt; }; // An instantiation of Foo is required for warning to reproduce void* makeFoo() { return new Foo(); }