[cfe-users] misc-new-delete-overloads

Jonas Toth via cfe-users cfe-users at lists.llvm.org
Fri Dec 28 08:07:27 PST 2018


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: https://bugs.llvm.org/show_bug.cgi?id=40174

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

Am 24.12.18 um 10:13 schrieb Tom Hulton-Harrop via cfe-users:
> 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 :)
>
> 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,
>
>
> Tom
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20181228/c8957cf5/attachment.html>


More information about the cfe-users mailing list