From 2811648114206a2f711e9a1fcfb4048fafb3c3ae Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 19 Mar 2026 01:05:45 -1000 Subject: [PATCH] Fix -Wshadow: rename lambda parameter to avoid shadowing outer topic --- esphome/components/mqtt/custom_mqtt_device.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/esphome/components/mqtt/custom_mqtt_device.h b/esphome/components/mqtt/custom_mqtt_device.h index 84c182ea03..a003379fe0 100644 --- a/esphome/components/mqtt/custom_mqtt_device.h +++ b/esphome/components/mqtt/custom_mqtt_device.h @@ -191,8 +191,7 @@ void CustomMQTTDevice::subscribe(const std::string &topic, void (T::*callback)(const std::string &, const std::string &), uint8_t qos) { auto *obj = static_cast(this); global_mqtt_client->subscribe( - topic, - [obj, callback](const std::string &topic, const std::string &payload) { (obj->*callback)(topic, payload); }, qos); + topic, [obj, callback](const std::string &t, const std::string &payload) { (obj->*callback)(t, payload); }, qos); } template void CustomMQTTDevice::subscribe(const std::string &topic, void (T::*callback)(const std::string &), uint8_t qos) { @@ -210,7 +209,7 @@ void CustomMQTTDevice::subscribe_json(const std::string &topic, void (T::*callba uint8_t qos) { auto *obj = static_cast(this); global_mqtt_client->subscribe_json( - topic, [obj, callback](const std::string &topic, JsonObject root) { (obj->*callback)(topic, root); }, qos); + topic, [obj, callback](const std::string &t, JsonObject root) { (obj->*callback)(t, root); }, qos); } template void CustomMQTTDevice::subscribe_json(const std::string &topic, void (T::*callback)(JsonObject), uint8_t qos) {