https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100485
Bug ID: 100485
Summary: False positive in -Wmismatched-new-delete
Product: gcc
Version: 11.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fiesh at zefix dot tv
Target Milestone: ---
The following code triggers -Wmismatched-new-delete:
----------------------------------------
extern "C" void free(void *);
class Base
{
public:
Base();
void * operator new(unsigned long, const int &);
void operator delete(void * ptr, const int &) { free(ptr); }
};
void f()
{
new (0) Base;
}
----------------------------------------
Supplying `__attribute__((malloc (free, 1)))` to `operator new` also doesn't
help.