Home | News | Documentation | Download

Variant including RResultPtr doesn't compile with GCC 9.1

I have code that uses std::variant<RResultPtr<double>, double> (actually an std::vector of them). It compiles with GCC 8.2.0 but not GCC 9.1.0:

/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:159:16: error: cannot cast private base class 'std::__detail::__variant::_Move_ctor_base<false, ROOT::RDF::RResultPtr<double>, double>' to 'std::variant<ROOT::RDF::RResultPtr<double>, double>'
        return static_cast<variant<_Types...>&&>(__rhs);
               ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:482:5: note: in instantiation of function template specialization 'std::__variant_cast<ROOT::RDF::RResultPtr<double>, double, std::__detail::__variant::_Move_ctor_base<false, ROOT::RDF::RResultPtr<double>, double> >' requested here
        }, __variant_cast<_Types...>(std::forward<_Up>(__rhs)));
           ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:525:2: note: in instantiation of function template specialization 'std::__detail::__variant::__variant_construct<ROOT::RDF::RResultPtr<double>, double, std::__detail::__variant::_Move_ctor_base<false, ROOT::RDF::RResultPtr<double>, double> &,
      std::__detail::__variant::_Move_ctor_base<false, ROOT::RDF::RResultPtr<double>, double> >' requested here
        __variant_construct<_Types...>(*this, std::move(__rhs));
        ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:620:7: note: in instantiation of member function 'std::__detail::__variant::_Move_ctor_base<false, ROOT::RDF::RResultPtr<double>, double>::_Move_ctor_base' requested here
      _Copy_assign_base(_Copy_assign_base&&) = default;
      ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/bits/alloc_traits.h:484:8: note: in instantiation of function template specialization '__gnu_cxx::new_allocator<std::variant<ROOT::RDF::RResultPtr<double>, double> >::construct<std::variant<ROOT::RDF::RResultPtr<double>, double>,
      std::variant<ROOT::RDF::RResultPtr<double>, double> >' requested here
        { __a.construct(__p, std::forward<_Args>(__args)...); }
              ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/bits/vector.tcc:115:21: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<std::variant<ROOT::RDF::RResultPtr<double>, double> > >::construct<std::variant<ROOT::RDF::RResultPtr<double>, double>,
      std::variant<ROOT::RDF::RResultPtr<double>, double> >' requested here
            _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
                           ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/bits/stl_vector.h:1201:9: note: in instantiation of function template specialization 'std::vector<std::variant<ROOT::RDF::RResultPtr<double>, double>, std::allocator<std::variant<ROOT::RDF::RResultPtr<double>, double> >
      >::emplace_back<std::variant<ROOT::RDF::RResultPtr<double>, double> >' requested here
      { emplace_back(std::move(__x)); }
        ^
/home/beojan/DPhil/hh4b/Resolved/recon/rdf-utils/Cutflow/CutflowWeighted.h:26:16: note: in instantiation of member function 'std::vector<std::variant<ROOT::RDF::RResultPtr<double>, double>, std::allocator<std::variant<ROOT::RDF::RResultPtr<double>, double> > >::push_back' requested here
        values.push_back(value);
               ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:1220:7: note: constrained by private inheritance here
    : private __detail::__variant::_Variant_base<_Types...>,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:156:13: error: cannot cast private base class 'std::__detail::__variant::_Variant_storage<false, ROOT::RDF::RResultPtr<double>, double>' to 'std::variant<ROOT::RDF::RResultPtr<double>, double>'
            return static_cast<variant<_Types...>&>(__rhs);
                   ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:392:7: note: in instantiation of function template specialization 'std::__variant_cast<ROOT::RDF::RResultPtr<double>, double, std::__detail::__variant::_Variant_storage<false, ROOT::RDF::RResultPtr<double>, double> &>' requested here
          }, __variant_cast<_Types...>(*this));
             ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:397:2: note: in instantiation of member function 'std::__detail::__variant::_Variant_storage<false, ROOT::RDF::RResultPtr<double>, double>::_M_reset_impl' requested here
        _M_reset_impl();
        ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:402:9: note: in instantiation of member function 'std::__detail::__variant::_Variant_storage<false, ROOT::RDF::RResultPtr<double>, double>::_M_reset' requested here
      { _M_reset(); }
        ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:492:20: note: in instantiation of member function 'std::__detail::__variant::_Variant_storage<false, ROOT::RDF::RResultPtr<double>, double>::~_Variant_storage' requested here
      using _Base::_Base;
                   ^
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/variant:1220:7: note: constrained by private inheritance here
    : private __detail::__variant::_Variant_base<_Types...>,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ROOT Version: 6.18
Platform: Arch
Compiler: GCC 9.1.0


Hi @beojan ,
this is https://sft.its.cern.ch/jira/browse/ROOT-10220 isn’t it?

Yes

Sincerely,

Beojan Stanislaus

Let’s follow this up as a bug report then :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.