Skip to content

Commit e1820a2

Browse files
committed
Disable -Wmaybe-uninitialized false positive. Refs #55.
1 parent 74f6f0c commit e1820a2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

include/boost/variant2/variant.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,20 @@ template<class T1, class... T> union variant_storage_impl<mp11::mp_false, T1, T.
558558
T1 first_;
559559
variant_storage<T...> rest_;
560560

561+
#if defined(BOOST_GCC) && (__GNUC__ >= 12)
562+
// false positive, see https://github.com/boostorg/variant2/issues/55
563+
# pragma GCC diagnostic push
564+
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
565+
#endif
566+
561567
template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... )
562568
{
563569
}
564570

571+
#if defined(BOOST_GCC) && (__GNUC__ >= 12)
572+
# pragma GCC diagnostic pop
573+
#endif
574+
565575
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)... )
566576
{
567577
}
@@ -704,6 +714,7 @@ template<class T1, class... T> union variant_storage_impl<mp11::mp_true, T1, T..
704714
# pragma GCC diagnostic ignored "-Wuninitialized"
705715
#endif
706716
#endif
717+
707718
*this = variant_storage_impl( mp11::mp_size_t<I>(), std::forward<A>(a)... );
708719

709720
#if defined(BOOST_GCC) && (__GNUC__ >= 7)

0 commit comments

Comments
 (0)