From df72954c088cf6175dcd2e018a6560184a25f8f5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 9 Jul 2025 22:13:25 -1000 Subject: [PATCH] fix --- esphome/components/api/proto.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/api/proto.h b/esphome/components/api/proto.h index 27b04114b1..c44c644cd3 100644 --- a/esphome/components/api/proto.h +++ b/esphome/components/api/proto.h @@ -22,7 +22,8 @@ using SizeFunc = void (*)(uint32_t &total_size, const void *field_ptr, uint8_t f // Macro to calculate field offset without triggering -Winvalid-offsetof // This uses the same approach as offsetof but with explicit reinterpret_cast -#define PROTO_FIELD_OFFSET(Type, Member) (reinterpret_cast(&reinterpret_cast(16)->Member) - 16) +#define PROTO_FIELD_OFFSET(Type, Member) \ + static_cast(reinterpret_cast(&reinterpret_cast(16)->Member) - 16) // Function pointer types for repeated fields using RepeatedEncodeFunc = void (*)(ProtoWriteBuffer &, const void *field_ptr, uint8_t field_num);