Compare commits

...

3 Commits

Author SHA1 Message Date
Peter Dimov
dde1a3ac91 Reference #57 and #58 in comments as well 2026-02-24 21:01:36 +02:00
Peter Dimov
4a1f14cb68 Merge pull request #57 from alandefreitas/fix/issue-55-missing-pragma
fix: add missing -Wmaybe-uninitialized pragma to recursive variant_storage_impl
2026-02-24 20:55:38 +02:00
Alan de Freitas
b6ce8ac8ad Add missing -Wmaybe-uninitialized pragma to recursive variant_storage_impl
The pragma added in the flat (10-member) specialization
for #55 is missing from the recursive (T1, T...)
specialization. GCC 14/15 at -O3 triggers the same
false positive here when deeply inlining constexpr
functions (e.g. system::result<url_view> construction).

Refs #55
2026-02-23 22:44:54 -05:00

View File

@@ -625,8 +625,10 @@ template<class T1, class... T> union variant_storage_impl<mp11::mp_false, T1, T.
T1 first_;
variant_storage<T...> rest_;
#if defined(BOOST_GCC) && (__GNUC__ >= 12)
#if defined(BOOST_GCC) && (__GNUC__ >= 7)
// false positive, see https://github.com/boostorg/variant2/issues/55
// ... and https://github.com/boostorg/variant2/pull/57
// ... and https://github.com/boostorg/variant2/pull/58
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
@@ -635,7 +637,7 @@ template<class T1, class... T> union variant_storage_impl<mp11::mp_false, T1, T.
{
}
#if defined(BOOST_GCC) && (__GNUC__ >= 12)
#if defined(BOOST_GCC) && (__GNUC__ >= 7)
# pragma GCC diagnostic pop
#endif
@@ -752,10 +754,22 @@ template<class T1, class... T> union variant_storage_impl<mp11::mp_true, T1, T..
T1 first_;
variant_storage<T...> rest_;
#if defined(BOOST_GCC) && (__GNUC__ >= 7)
// false positive, see https://github.com/boostorg/variant2/issues/55
// ... and https://github.com/boostorg/variant2/pull/57
// ... and https://github.com/boostorg/variant2/pull/58
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... )
{
}
#if defined(BOOST_GCC) && (__GNUC__ >= 7)
# pragma GCC diagnostic pop
#endif
template<std::size_t I, class... A> constexpr variant_storage_impl( mp11::mp_size_t<I>, A&&... a ): rest_( mp11::mp_size_t<I-1>(), std::forward<A>(a)... )
{
}