mirror of
https://github.com/esphome/esphome.git
synced 2026-09-13 00:07:32 +00:00
[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().
This commit is contained in:
@@ -1756,7 +1756,7 @@ template<typename... Ts> struct Callback<void(Ts...)> {
|
||||
cb.fn = [](void *c, Ts... args) {
|
||||
alignas(DecayF) char buf[sizeof(DecayF)];
|
||||
__builtin_memcpy(buf, &c, sizeof(DecayF));
|
||||
reinterpret_cast<DecayF *>(buf)->operator()(args...);
|
||||
(*reinterpret_cast<DecayF *>(buf))(args...);
|
||||
};
|
||||
return cb;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user