From 6608b3493cfac0b44ef3484ec62ca4a75e1bcbbd Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 19 Feb 2026 16:30:16 -0600 Subject: [PATCH] [core] Use constexpr for PROGMEM arrays Change progmem_array codegen from `static const` to `static constexpr`. This ensures the compiler evaluates the array at compile time with no runtime initialization, and is the correct qualifier for constant data known at compile time. Co-Authored-By: Claude Opus 4.6 --- esphome/cpp_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/cpp_generator.py b/esphome/cpp_generator.py index 83f2d6cf81..fe666bdd6e 100644 --- a/esphome/cpp_generator.py +++ b/esphome/cpp_generator.py @@ -424,7 +424,7 @@ class ProgmemAssignmentExpression(AssignmentExpression): super().__init__(type_, "", name, rhs) def __str__(self): - return f"static const {self.type} {self.name}[] PROGMEM = {self.rhs}" + return f"static constexpr {self.type} {self.name}[] PROGMEM = {self.rhs}" class StaticConstAssignmentExpression(AssignmentExpression):