diff --git a/AK/RefCounted.h b/AK/RefCounted.h index 0ee14d228df..ce48e6e73fd 100644 --- a/AK/RefCounted.h +++ b/AK/RefCounted.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -62,7 +63,9 @@ public: if (new_ref_count == 0) { if constexpr (requires { that->will_be_destroyed(); }) that->will_be_destroyed(); - delete static_cast(this); + // FIXME: GCC 15.1.0 seems to think this is reachable with non-heap objects + // in some possibly Variant related cases. + AK_IGNORE_DIAGNOSTIC("-Wfree-nonheap-object", delete static_cast(this);) return true; } return false;