This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/64841] libsanitizer/asan/asan_new_delete.cc:107:6: warning: âvoid operator delete(void*, size_t)â is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Wc++14-compat]
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Jan 2015 16:10:34 +0000
- Subject: [Bug sanitizer/64841] libsanitizer/asan/asan_new_delete.cc:107:6: warning: âvoid operator delete(void*, size_t)â is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Wc++14-compat]
- Auto-submitted: auto-generated
- References: <bug-64841-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64841
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I wonder if the correct fix would be:
--- a/libsanitizer/asan/asan_new_delete.cc
+++ b/libsanitizer/asan/asan_new_delete.cc
@@ -103,6 +103,7 @@ CXX_OPERATOR_ATTRIBUTE
void operator delete[](void *ptr, std::nothrow_t const&) {
OPERATOR_DELETE_BODY(FROM_NEW_BR);
}
+#if __cpp_sized_deallocation
CXX_OPERATOR_ATTRIBUTE
void operator delete(void *ptr, size_t size) throw() {
GET_STACK_TRACE_FREE;
@@ -113,6 +114,7 @@ void operator delete[](void *ptr, size_t size) throw() {
GET_STACK_TRACE_FREE;
asan_sized_free(ptr, size, &stack, FROM_NEW_BR);
}
+#endif
#else // SANITIZER_MAC
INTERCEPTOR(void, _ZdlPv, void *ptr) {
That way the functions are only declared if the compiler knows what to do with
them (i.e. it supports the C++14 sized deallocation feature).
The patch should go to the libsanitizer upstream though.