Skip to content

Commit 39a2a85

Browse files
Hendiadyoin1alimpfard
authored andcommitted
AK: Ignore -Wfree-nonheap-object on RefCounted::unref
GCC 15 seems to raise a false positive here in some cases (cherry picked from commit 129c3ec0df061930e58f6d15d2ee4ad3e7599aad)
1 parent 0f6f5cd commit 39a2a85

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

AK/RefCounted.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <AK/Assertions.h>
1010
#include <AK/Checked.h>
11+
#include <AK/Diagnostics.h>
1112
#include <AK/Noncopyable.h>
1213
#include <AK/Platform.h>
1314

@@ -62,7 +63,9 @@ class RefCounted : public RefCountedBase {
6263
if (new_ref_count == 0) {
6364
if constexpr (requires { that->will_be_destroyed(); })
6465
that->will_be_destroyed();
65-
delete static_cast<T const*>(this);
66+
// FIXME: GCC 15.1.0 seems to think this is reachable with non-heap objects
67+
// in some possibly Variant related cases.
68+
AK_IGNORE_DIAGNOSTIC("-Wfree-nonheap-object", delete static_cast<T const*>(this);)
6669
return true;
6770
}
6871
return false;

0 commit comments

Comments
 (0)