https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84476
Martin Ankerl <martin.ankerl at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.ankerl at gmail dot com --- Comment #1 from Martin Ankerl <martin.ankerl at gmail dot com> --- I just "discovered" this bug as well. The warning works correctly in g++ 6.4, but starting from 7.1 upwards it does not work any more. My reproducer which is very similar: struct Foo { [[nodiscard]] virtual bool foo() { return true; }; virtual ~Foo() = default; }; void shouldEmitWarning() { auto* f = new Foo(); f->foo(); // <-- why no warning here? delete f; } Godbolt link: https://godbolt.org/z/xqaPrshYn