From 398a64b5e0b649588e4728e89c57d9e37e2a9e6e Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sun, 2 Oct 2022 11:13:04 +0200 Subject: [PATCH] shut down unavoidable GCC shadowing warnings --- include/boost/unordered/detail/foa.hpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/boost/unordered/detail/foa.hpp b/include/boost/unordered/detail/foa.hpp index 52a1bfb6..6085ea77 100644 --- a/include/boost/unordered/detail/foa.hpp +++ b/include/boost/unordered/detail/foa.hpp @@ -847,6 +847,28 @@ struct ebo_base< const T& get()const{return *this;} }; +#if defined(BOOST_GCC) +/* GCC's -Wshadow triggers at scenarios like this: + * + * struct foo{}; + * template + * struct derived:Base + * { + * void f(){int foo;} + * }; + * + * derivedx; + * x.f(); // declaration of "foo" in derived::f shadows base type "foo" + * + * This makes shadowing warnings unavoidable in general when a class template + * derives from user-provided classes, as is the case with table and + * ebo_base's below. + */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#endif + template class @@ -1452,6 +1474,10 @@ private: std::size_t ml; }; +#if defined(BOOST_GCC) +#pragma GCC diagnostic pop /* ignored "-Wshadow" */ +#endif + } /* namespace foa */ } /* namespace detail */ } /* namespace unordered */