From 27942f19733d442998bd457531ffbc58ac3e8f63 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 14 Mar 2026 11:05:39 -1000 Subject: [PATCH] [helpers] Replace deprecated std::is_trivial in FixedRingBuffer (#14808) --- esphome/core/helpers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 2267208752..c2f4cace9a 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -417,7 +417,7 @@ template::max()> FixedRingBuffer() = default; ~FixedRingBuffer() { - if constexpr (std::is_trivial::value) { + if constexpr (std::is_trivially_copyable::value && std::is_trivially_default_constructible::value) { ::operator delete(this->data_); } else { delete[] this->data_; @@ -430,7 +430,7 @@ template::max()> /// Allocate capacity - can only be called once void init(index_type capacity) { - if constexpr (std::is_trivial::value) { + if constexpr (std::is_trivially_copyable::value && std::is_trivially_default_constructible::value) { // Raw allocation without initialization (elements are written before read) // NOLINTNEXTLINE(bugprone-sizeof-expression) this->data_ = static_cast(::operator new(capacity * sizeof(T)));