Hi there,

Apologies if this is the wrong place to ask about this - if it is I’d be very grateful if you’d point me in the right direction :slight_smile:

I’m seeing the clang-tidy warning ‘misc-new-delete-overloads’ when using the two parameter version of class member delete, however when using the single parameter version the warning goes away.

class Type
void* operator new(size_t) { … }
void operator delete(void*) { … } // no warning
void operator delete (void*, size_t) { … } // warning

When using the second version I don’t think this warning should be reported. Is this correct or am I missing something?

I’ve been double checking things here:

https://en.cppreference.com/w/cpp/memory/new/operator_new (Items 15, 16)

https://en.cppreference.com/w/cpp/memory/new/operator_delete (Items 17, 18 and 21, 22)

I’m using clang on Windows and using Clang Power Tools in Visual Studio to invoke clang-tidy.

Any info would be greatly appreciated!

Thank you for your time,


Hey Tom,

thank you for reporting this issue!

Tt looks like the check is confusing these overloads somehow. Looking through the code it could be, that the second version is considered as placement-overload which are ignored, but that is just a guess.
Are you by any chance compiling with C++17? It added versions to both operators the check might not expect.

I created a bug-report:

You could help with producing a minimal reproducer-file with C+±Standard and build-configuration added that we can attach to the bug-report. Having such a file would help a lot adressing the issue!

Best, Jonas