From 70733fa9132ae01bf920ac2765d22f8787396e3e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 15 Mar 2026 22:39:31 -1000 Subject: [PATCH] [core] Fix Callback invocation for function pointer callables Use (*ptr)(args...) instead of ptr->operator()(args...) so the inline path works correctly for function pointers, which are trivially copyable and pointer-sized but lack operator(). --- esphome/core/helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 5eab5b475d..efba3aa56e 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -1756,7 +1756,7 @@ template struct Callback { cb.fn = [](void *c, Ts... args) { alignas(DecayF) char buf[sizeof(DecayF)]; __builtin_memcpy(buf, &c, sizeof(DecayF)); - reinterpret_cast(buf)->operator()(args...); + (*reinterpret_cast(buf))(args...); }; return cb; } else {