Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile error with boost fusion #23

Open
zhuoqiang opened this issue Dec 8, 2021 · 1 comment
Open

compile error with boost fusion #23

zhuoqiang opened this issue Dec 8, 2021 · 1 comment

Comments

@zhuoqiang
Copy link

  • compiler: g++ 11 std=20
  • boost 1.77
  • visit_struct: 8c91d22

source code trigger the error

#include <visit_struct/visit_struct_boost_fusion.hpp>
BOOST_FUSION_DEFINE_STRUCT((), FusionParams,
                           (int, param1)(double, param2))

template <class Params>
constexpr void PopulateVsFoo(const Params& params) {
  visit_struct::for_each(params, []<typename T>(const char*, const T&) {});
}

void test() {
  FusionParams p;
  PopulateVsFoo(p);
}

compile error:

In file included from /param_test.cpp:1:
/visit_struct/include/visit_struct/visit_struct_boost_fusion.hpp: In instantiation of 'static void visit_struct::traits::visitable<S, typename std::enable_if<std::is_same<typename boost::mpl::sequence_tag<Sequence>::type, boost::fusion::fusion_sequence_tag>::value>::type>::apply(V&&, T&&) [with V = PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>; T = const {anonymous}::FusionParams&; S = {anonymous}::FusionParams]':
/visit_struct/include/visit_struct/visit_struct.hpp:144:47:   required from 'constexpr typename std::enable_if<visit_struct::traits::is_visitable<typename visit_struct::traits::clean<S>::type>::value>::type visit_struct::for_each(S&&, V&&) [with V = PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>; S = const {anonymous}::FusionParams&; typename std::enable_if<visit_struct::traits::is_visitable<typename visit_struct::traits::clean<S>::type>::value>::type = void; typename visit_struct::traits::clean<S>::type = {anonymous}::FusionParams]'
/param_test.cpp:6:25:   required from 'constexpr void PopulateVsFoo(const Params&) [with Params = {anonymous}::FusionParams]'
/param_test.cpp:11:16:   required from here
/visit_struct/include/visit_struct/visit_struct_boost_fusion.hpp:133:21: error: use of deleted function 'visit_struct::traits::visitable<{anonymous}::FusionParams, void>::fusion_visitor<PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>&&, const {anonymous}::FusionParams&>::fusion_visitor(const visit_struct::traits::visitable<{anonymous}::FusionParams, void>::fusion_visitor<PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>&&, const {anonymous}::FusionParams&>&)'
  133 |     fusion::for_each(Indices(), fv);
      |     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/visit_struct/include/visit_struct/visit_struct_boost_fusion.hpp:66:10: note: 'visit_struct::traits::visitable<{anonymous}::FusionParams, void>::fusion_visitor<PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>&&, const {anonymous}::FusionParams&>::fusion_visitor(const visit_struct::traits::visitable<{anonymous}::FusionParams, void>::fusion_visitor<PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>&&, const {anonymous}::FusionParams&>&)' is implicitly deleted because the default definition would be ill-formed:
   66 |   struct fusion_visitor {
      |          ^~~~~~~~~~~~~~
/visit_struct/include/visit_struct/visit_struct_boost_fusion.hpp:66:10: error: copying non-static data member 'PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>&& visit_struct::traits::visitable<{anonymous}::FusionParams, void>::fusion_visitor<PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>&&, const {anonymous}::FusionParams&>::visitor' of rvalue reference type
In file included from /boost/fusion/include/for_each.hpp:11,
                 from /visit_struct/include/visit_struct/visit_struct_boost_fusion.hpp:12,
                 from /param_test.cpp:1:
/boost/fusion/algorithm/iteration/for_each.hpp:41:37: note:   initializing argument 2 of 'constexpr typename boost::enable_if<boost::fusion::traits::is_sequence<Sequence> >::type boost::fusion::for_each(const Sequence&, F) [with Sequence = boost::mpl::range_c<unsigned int, 0, 2>; F = visit_struct::traits::visitable<{anonymous}::FusionParams, void>::fusion_visitor<PopulateVsFoo<{anonymous}::FusionParams>(const {anonymous}::FusionParams&)::<lambda(const char*, const T&)>&&, const {anonymous}::FusionParams&>; typename boost::enable_if<boost::fusion::traits::is_sequence<Sequence> >::type = void]'
   41 |     for_each(Sequence const& seq, F f)
      |                                   ~~^
@cbeck88
Copy link
Owner

cbeck88 commented Apr 15, 2023

Thanks, i havent tested this with latest boost, ill take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants