diff --git a/include/boost/optional/detail/union_optional.hpp b/include/boost/optional/detail/union_optional.hpp index 46daecba..16e150f4 100644 --- a/include/boost/optional/detail/union_optional.hpp +++ b/include/boost/optional/detail/union_optional.hpp @@ -74,9 +74,20 @@ union constexpr_union_storage_t constexpr constexpr_union_storage_t( trivial_init_t ) noexcept : dummy_() {}; +#if defined(BOOST_GCC) && (__GNUC__ >= 7) +// false positive, see https://github.com/boostorg/variant2/issues/55, +// https://github.com/boostorg/url/issues/979 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + template constexpr constexpr_union_storage_t( Args&&... args ) : value_(forward_(args)...) {} +#if defined(BOOST_GCC) && (__GNUC__ >= 7) +# pragma GCC diagnostic pop +#endif + //~constexpr_union_storage_t() = default; // No need to destroy a trivially-destructible type }; @@ -88,9 +99,20 @@ union fallback_union_storage_t constexpr fallback_union_storage_t( trivial_init_t ) noexcept : dummy_() {}; +#if defined(BOOST_GCC) && (__GNUC__ >= 7) +// false positive, see https://github.com/boostorg/variant2/issues/55, +// https://github.com/boostorg/url/issues/979 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + template constexpr fallback_union_storage_t( Args&&... args ) : value_(forward_(args)...) {} +#if defined(BOOST_GCC) && (__GNUC__ >= 7) +# pragma GCC diagnostic pop +#endif + ~fallback_union_storage_t(){} // My owner will destroy the `T` if needed. // Cannot default in a union with nontrivial `T`. };