https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100485
--- Comment #5 from fiesh at zefix dot tv --- > extern "C" void free (void *); > > class Base > { > public: > Base(); > > void * operator new(unsigned long, const int &); > void operator delete(void * ptr, const int &) { > #pragma GCC diagnostic ignored "-Wmismatched-new-delete" > free (ptr); > } > }; > > void f() > { > new (0) Base; > } Alas, keeping the diagnostic ignore local by means of `diagnostic push` / `diagnostic pop` makes it not work correctly, presumably since the warning is generated at the call site. Making it global to everything including the header file seems like a bad idea to me.