From dd626013b972d669475466ed5c3d6a7396a8f028 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Tue, 28 Apr 2026 20:41:42 -0500 Subject: [PATCH] AK: Allow AtomicRefCounted to destroy classes using virtual inheritance This warning is suppressed in RefCounted.h as well. --- AK/AtomicRefCounted.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AK/AtomicRefCounted.h b/AK/AtomicRefCounted.h index 77cd74c14f..b0151aa135 100644 --- a/AK/AtomicRefCounted.h +++ b/AK/AtomicRefCounted.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -73,7 +74,8 @@ public: if (new_ref_count == 0) { if constexpr (requires { that->will_be_destroyed(); }) that->will_be_destroyed(); - delete that; + // This GCC diagnostic gives a false positive on pointers to classes using virtual inheritance. + AK_IGNORE_DIAGNOSTIC("-Wfree-nonheap-object", delete that;) return true; } return false;