From 004594a624076eccfd819bc113cbfcb48bb8fd6b Mon Sep 17 00:00:00 2001 From: Lee Leahy Date: Mon, 9 Sep 2024 14:30:19 -1000 Subject: [PATCH] Issue 10316: Workaround bug in getStdFunctionAddress --- libraries/Network/src/NetworkEvents.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/Network/src/NetworkEvents.cpp b/libraries/Network/src/NetworkEvents.cpp index 9ebf00b476a..6792811766f 100644 --- a/libraries/Network/src/NetworkEvents.cpp +++ b/libraries/Network/src/NetworkEvents.cpp @@ -225,10 +225,8 @@ void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event } } -template static size_t getStdFunctionAddress(std::function f) { - typedef T(fnType)(U...); - fnType **fnPointer = f.template target(); - return (size_t)*fnPointer; +static size_t getStdFunctionAddress(NetworkEventFuncCb cbEvent) { + return *(size_t *)(void *)&cbEvent; } void NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event) {