From 9229ed30103df59a4f989ca0235b0d1026bf6e1c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 12 Feb 2023 04:47:38 +0200 Subject: [PATCH] Avoid another -Wmaybe-uninitialized under GCC 11/12 --- include/boost/function/function_template.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index dcfc8f0..bd0ce79 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -501,8 +501,16 @@ namespace boost { void clear(function_buffer& functor) const { +#if defined(BOOST_GCC) && (__GNUC__ >= 11) +# pragma GCC diagnostic push +// False positive in GCC 11/12 for empty function objects +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif if (base.manager) base.manager(functor, functor, destroy_functor_tag); +#if defined(BOOST_GCC) && (__GNUC__ >= 11) +# pragma GCC diagnostic pop +#endif } private: