From d1553a761e44817f1b1f5108db5eb9aaac078dfd Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 27 Jan 2026 14:04:59 -0400 Subject: [PATCH] MT#62181 add string assignment operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following brief compiler warning: In file included from /usr/include/c++/15/string:56, from src/XmlRpcServer.h:13, from src/XmlRpcServer.cpp:3: In member function ‘constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pointer std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_data() const [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’, inlined from ‘constexpr bool std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_is_local() const [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /usr/include/c++/15/bits/basic_string.h:280:13, inlined from ‘constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_dispose() [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /usr/include/c++/15/bits/basic_string.h:298:18, inlined from ‘constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::~basic_string() [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /usr/include/c++/15/bits/basic_string.h:896:19, inlined from ‘constexpr void std::destroy_at(_Tp*) [with _Tp = __cxx11::basic_string]’ at /usr/include/c++/15/bits/stl_construct.h:88:18, inlined from ‘constexpr void std::_Destroy(_Tp*) [with _Tp = __cxx11::basic_string]’ at /usr/include/c++/15/bits/stl_construct.h:164:22, inlined from ‘std::__detail::__variant::_Variant_storage, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::_M_reset():: mutable [with auto:7 = std::__cxx11::basic_string&]’ at /usr/include/c++/15/variant:493:19, inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = __detail::__variant::_Variant_storage, allocator >, tm, vector >, vector >, map<__cxx11::basic_string, allocator >, XmlRpc::XmlRpcValue, less<__cxx11::basic_string, allocator > >, allocator, allocator >, XmlRpc::XmlRpcValue> > > >::_M_reset()::; _Args = {__cxx11::basic_string, allocator >&}]’ at /usr/include/c++/15/bits/invoke.h:63:36, inlined from ‘constexpr std::enable_if_t<((bool)is_invocable_r_v<_Res, _Callable, _Args ...>), _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res = void; _Callable = __detail::__variant::_Variant_storage, allocator >, tm, vector >, vector >, map<__cxx11::basic_string, allocator >, XmlRpc::XmlRpcValue, less<__cxx11::basic_string, allocator > >, allocator, allocator >, XmlRpc::XmlRpcValue> > > >::_M_reset()::; _Args = {__cxx11::basic_string, allocator >&}]’ at /usr/include/c++/15/bits/invoke.h:113:28, inlined from ‘static constexpr decltype(auto) std::__detail::__variant::__gen_vtable_impl, std::integer_sequence >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = void; _Visitor = std::__detail::__variant::_Variant_storage, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::_M_reset()::&&; _Variants = {std::variant, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >&}; long unsigned int ...__indices = {4}]’ at /usr/include/c++/15/variant:1059:40, inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = void; _Visitor = __detail::__variant::_Variant_storage, allocator >, tm, vector >, vector >, map<__cxx11::basic_string, allocator >, XmlRpc::XmlRpcValue, less<__cxx11::basic_string, allocator > >, allocator, allocator >, XmlRpc::XmlRpcValue> > > >::_M_reset()::; _Variants = {variant, allocator >, tm, vector >, vector >, map<__cxx11::basic_string, allocator >, XmlRpc::XmlRpcValue, less<__cxx11::basic_string, allocator > >, allocator, allocator >, XmlRpc::XmlRpcValue> > > >&}]’ at /usr/include/c++/15/variant:1895:5, inlined from ‘constexpr void std::__detail::__variant::_Variant_storage::_M_reset() [with _Types = {std::monostate, bool, long int, double, std::__cxx11::basic_string, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > >}]’ at /usr/include/c++/15/variant:491:23, inlined from ‘constexpr void std::__detail::__variant::__emplace(_Variant_storage<_Triv, _Types ...>&, _Args&& ...) [with long unsigned int _Np = 4; bool _Triv = false; _Types = {std::monostate, bool, long int, double, std::__cxx11::basic_string, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > >}; _Args = {std::__cxx11::basic_string, std::allocator >}]’ at /usr/include/c++/15/variant:560:19, inlined from ‘constexpr std::enable_if_t<((bool)is_constructible_v::__to_type<_Np, typename std::enable_if<(_Np < sizeof... (_Types)), void>::type>, _Args ...>), std::variant<_Types>::__to_type<_Np>&> std::variant<_Types>::emplace(_Args&& ...) [with long unsigned int _Np = 4; _Args = {std::__cxx11::basic_string, std::allocator >}; _Types = {std::monostate, bool, long int, double, std::__cxx11::basic_string, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > >}]’ at /usr/include/c++/15/variant:1604:33, inlined from ‘constexpr std::enable_if_t<((bool)((__exactly_once::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type> > && is_constructible_v::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type>, _Tp>) && is_assignable_v::__accepted_type<_Tp&&, typename std::enable_if<__not_self<_Tp&&>, void>::type>&, _Tp>)), std::variant<_Types>&> std::variant<_Types>::operator=(_Tp&&) [with _Tp = const std::__cxx11::basic_string&; _Types = {std::monostate, bool, long int, double, std::__cxx11::basic_string, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > >}]’ at /usr/include/c++/15/variant:1566:25, inlined from ‘XmlRpc::XmlRpcValue::XmlRpcValue(const std::string&)’ at src/XmlRpcValue.h:65:16, inlined from ‘void XmlRpc::XmlRpcServer::listMethods(XmlRpc::XmlRpcValue&)’ at src/XmlRpcServer.cpp:318:15: /usr/include/c++/15/bits/basic_string.h:239:28: warning: ‘*(const std::__cxx11::basic_string, std::allocator >*)((char*)& + offsetof(const XmlRpc::XmlRpcValue, XmlRpc::XmlRpcValue::_value.std::variant, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::.std::__detail::__variant::_Variant_base, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::.std::__detail::__variant::_Move_assign_base, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::.std::__detail::__variant::_Copy_assign_base, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::.std::__detail::__variant::_Move_ctor_base, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::.std::__detail::__variant::_Copy_ctor_base, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::.std::__detail::__variant::_Variant_storage, std::allocator >, tm, std::vector >, std::vector >, std::map, std::allocator >, XmlRpc::XmlRpcValue, std::less, std::allocator > >, std::allocator, std::allocator >, XmlRpc::XmlRpcValue> > > >::_M_u)).std::__cxx11::basic_string::_M_dataplus.std::__cxx11::basic_string::_Alloc_hider::_M_p’ may be used uninitialized [-Wmaybe-uninitialized] 239 | { return _M_dataplus._M_p; } | ^~~~ src/XmlRpcServer.cpp: In member function ‘void XmlRpc::XmlRpcServer::listMethods(XmlRpc::XmlRpcValue&)’: src/XmlRpcServer.cpp:318:15: note: ‘’ declared here 318 | result[i] = MULTICALL; | ^~~~~~~~~ Change-Id: Ie587b65ec0cfcc7ef9049dd526d9298e72af8aa4 --- apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h index fcc71015..bf6adca9 100644 --- a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h +++ b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h @@ -112,6 +112,9 @@ namespace XmlRpc { //! Assign a string to this XmlRpcValue. XmlRpcValue& operator=(const char* rhs) { return operator=(XmlRpcValue(std::string(rhs))); } + //! Assign a string to this XmlRpcValue. + XmlRpcValue& operator=(const std::string& rhs) { return operator=(XmlRpcValue(rhs)); } + //! Tests two XmlRpcValues for equality bool operator==(XmlRpcValue const& other) const = default;