Currently, clang rejects all attempts to visit a libstdc++ variant:
https://godbolt.org/g/kSmBTg

While gcc doesn't reject such code, that seems like an access checking
bug. This patch makes the offending _M_u member accessible for the rest
of the code.

2017-02-07  Ville Voutilainen  <ville.voutilai...@gmail.com>

    Fix an access problem in variant.
    * include/std/variant (variant): Add a using-declaration for
    _Base::_M_u.
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index c5138e5..54e8b67 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -957,6 +957,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          __detail::__variant::__index_of_v<_Tp, _Types...>;
 
     public:
+      using _Base::_M_u;
       constexpr variant()
       noexcept(is_nothrow_default_constructible_v<__to_type<0>>) = default;
       variant(const variant&) = default;

Reply via email to