From 674fb1d3f6c2ded7f88fc2ed72d4556c58baff92 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 13 Apr 2026 16:57:58 -1000 Subject: [PATCH] [light] Drop redundant is_standard_layout asserts (offsetof no longer used) Since validate_() now accesses unit_fields_[] directly via the union alias, there's no offsetof arithmetic to guard. The FieldFlags bit layout assert is all that's needed. --- esphome/components/light/light_call.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/esphome/components/light/light_call.cpp b/esphome/components/light/light_call.cpp index c9a5af5277..7b28065e4e 100644 --- a/esphome/components/light/light_call.cpp +++ b/esphome/components/light/light_call.cpp @@ -1,5 +1,4 @@ #include -#include #include "light_call.h" #include "light_state.h" @@ -281,10 +280,7 @@ LightColorValues LightCall::validate_() { if (this->has_state()) v.set_state(this->state_); - // FieldFlags bits 0-7 must match unit_fields_ array indices; the union in - // both structs guarantees brightness_..warm_white_ alias unit_fields_[0..7]. - static_assert(std::is_standard_layout_v, "LightCall must be standard-layout"); - static_assert(std::is_standard_layout_v, "LightColorValues must be standard-layout"); + // FieldFlags bits 0-7 must match unit_fields_ array indices. static_assert(FLAG_HAS_BRIGHTNESS == 1u << 0 && FLAG_HAS_COLOR_BRIGHTNESS == 1u << 1 && FLAG_HAS_RED == 1u << 2 && FLAG_HAS_GREEN == 1u << 3 && FLAG_HAS_BLUE == 1u << 4 && FLAG_HAS_WHITE == 1u << 5 && FLAG_HAS_COLD_WHITE == 1u << 6 && FLAG_HAS_WARM_WHITE == 1u << 7,