From 905c5ecb4cd955e1bcf8edfe9320f3b472332329 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Tue, 13 May 2025 03:21:23 -0600 Subject: [PATCH] AK: Silence -Wfree-nonheap-object more generally in Function for gcc We were already silencing it at the site of the delete call, but gcc in distribution mode is more aggressive about inlining and still sees a delete that it doesn't like. --- AK/Function.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AK/Function.h b/AK/Function.h index 66843f0dbc0..ae67c42f98f 100644 --- a/AK/Function.h +++ b/AK/Function.h @@ -296,7 +296,8 @@ private: break; case FunctionKind::Outline: VERIFY(wrapper); - wrapper->destroy(); + // This code is a bit too clever for gcc. Pinky promise we're only deleting heap objects. + AK_IGNORE_DIAGNOSTIC("-Wfree-nonheap-object", wrapper->destroy()); break; case FunctionKind::Block: VERIFY(wrapper);