From: Remi Gacogne Date: Tue, 9 Dec 2025 08:34:56 +0000 (+0100) Subject: luawrapper: We also need to decay the type while reading it back X-Git-Tag: rec-5.4.0-beta1~57^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9154375897d2f4f3d2b4023deeb0cfb6549e8cd;p=thirdparty%2Fpdns.git luawrapper: We also need to decay the type while reading it back Signed-off-by: Remi Gacogne --- diff --git a/ext/luawrapper/include/LuaContext.hpp b/ext/luawrapper/include/LuaContext.hpp index 7a333dd444..97530a52ef 100644 --- a/ext/luawrapper/include/LuaContext.hpp +++ b/ext/luawrapper/include/LuaContext.hpp @@ -3039,8 +3039,12 @@ private: if constexpr (I >= nbTypes) { return boost::none; } - if (const auto val = Reader>::read(state, index)) { - return ReturnType{*val}; + using InitialType = std::variant_alternative_t; + using DecayedType = std::decay_t; + if (const auto val = Reader::read(state, index)) { + // we are using the initial, non-decayed type so that a + // cv-qualifiers are not ignored + return ReturnType{std::in_place_type, *val}; } if constexpr (I < (nbTypes - 1)) { return variantRead(state, index);