boostorg / boostorg/msm

Since 1.85 - flag_list can't be defined with boost::mp11::mp_list

Open
#88 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
40
Forks
59
PR merge metrics
No merged PRs in 30d

Description

`boost::mp11::mp_list` is mpl-compatible type-list and we have habit to use it for big state machines (20+ transitions).
It is really not necessary, but folks in my project use this mp_list also for other things - like initial_state or flag_list.

When we switched to 1.86 - flag_list defined with mp_list stops compiling with this errors

> In file included from /app/boost/include/boost/mp11/utility.hpp:14,
> from /app/boost/include/boost/parameter/aux_/result_of0.hpp:14,
> from /app/boost/include/boost/parameter/aux_/arg_list.hpp:51,
> from /app/boost/include/boost/parameter/parameters.hpp:22,
> from /app/boost/include/boost/parameter.hpp:11,
> from /app/boost/include/boost/msm/back/state_machine.hpp:54,
> from :1:
> /app/boost/include/boost/mp11/detail/mp_front.hpp: In substitution of 'template using boost::mp11::mp_front = typename boost::mp11::detail::mp_front_impl::type [with L = boost::mp11::mp_list<>]':
> /app/boost/include/boost/mp11/list.hpp:149:25: required by substitution of 'template using boost::mp11::mp_first = boost::mp11::mp_front [with L = boost::mp11::mp_list<>]'
> 149 | template using mp_first = mp_front;
> | ^~~~~~~~
> /app/boost/include/boost/mp11/detail/mpl_common.hpp:30:11: required from 'struct boost::mpl::aux::mp11_iterator >'
> 30 | using type = mp11::mp_first;
> | ^~~~
> /app/boost/include/boost/fusion/adapted/mpl/mpl_iterator.hpp:23:12: required from 'struct boost::fusion::mpl_iterator > >'
> 23 | struct mpl_iterator
> | ^~~~~~~~~~~~
> /app/boost/include/boost/type_traits/is_base_and_derived.hpp:226:5: required from 'const bool boost::detail::is_base_and_derived_impl > > >::value'
> 226 | BOOST_STATIC_CONSTANT(bool, value = (BOOST_IS_BASE_OF(B,D) && ! ::boost::is_same::value));
> | ^~~~~~~~~~~~~~~~
> /app/boost/include/boost/type_traits/is_base_of.hpp:24:11: required from 'const bool boost::detail::is_base_of_imp > > >::value'
> 24 | BOOST_STATIC_CONSTANT(bool, value = (
> | ^~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/type_traits/is_base_of.hpp:30:48: [ skipping 7 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
> /app/boost/include/boost/mpl/for_each.hpp:78:26: required from 'static void boost::mpl::aux::for_each_impl::execute(Iterator*, LastIterator*, TransformFunc*, F) [with Iterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::s_item > >; LastIterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::set0<> >; TransformFunc = boost::msm::wrap >; F = boost::msm::back::state_machine::init_flags]'
> 78 | aux::unwrap(f, 0)(boost::get(x));
> | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
> /app/boost/include/boost/mpl/for_each.hpp:82:22: required from 'static void boost::mpl::aux::for_each_impl::execute(Iterator*, LastIterator*, TransformFunc*, F) [with Iterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::s_item, boost::mpl::s_item > > >; LastIterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::set0<> >; TransformFunc = boost::msm::wrap >; F = boost::msm::back::state_machine::init_flags]'
> 81 | for_each_impl::value>
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 82 | ::execute( static_cast(0), static_cast(0), static_cast(0), f);
> | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/mpl/for_each.hpp:105:18: required from 'void boost::mpl::for_each(F, Sequence*, TransformOp*) [with Sequence = s_item, s_item > >; TransformOp = boost::msm::wrap >; F = boost::msm::back::state_machine::init_flags]'
> 104 | aux::for_each_impl< boost::is_same::value >
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 105 | ::execute(static_cast(0), static_cast(0), static_cast(0), f);
> | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/msm/back/state_machine.hpp:2386:29: required from 'bool (** boost::msm::back::state_machine::get_entries_for_flag() const)(const library_sm&) [with Flag = Flag1; A0 = Front; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_; flag_handler = bool (*)(const boost::msm::back::state_machine&)]'
> 2385 | (::boost::mpl::for_each >
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2386 | (init_flags(flags_entries)),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/msm/back/state_machine.hpp:1518:95: required from 'bool boost::msm::back::state_machine::is_flag_active() const [with Flag = Flag1; A0 = Front; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_]'
> 1518 | return FlagHelper1)>::helper(*this,get_entries_for_flag());
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>
> > :42:43: required from here
>
> 42 | std::cout << fsm.is_flag_active();
> | ~~~~~~~~~~~~~~~~~~~~~~~~~^~
> /app/boost/include/boost/mp11/detail/mp_front.hpp:45:25: error: no type named 'type' in 'struct boost::mp11::detail::mp_front_impl >'
> 45 | template using mp_front = typename detail::mp_front_impl::type;
> | ^~~~~~~~
> In file included from /app/boost/include/boost/mp11/mpl_list.hpp:11,
> from :6:
> /app/boost/include/boost/mp11/detail/mpl_common.hpp: In instantiation of 'struct boost::mpl::aux::mp11_iterator >':
> /app/boost/include/boost/fusion/adapted/mpl/mpl_iterator.hpp:23:12: required from 'struct boost::fusion::mpl_iterator > >'
> 23 | struct mpl_iterator
> | ^~~~~~~~~~~~
> /app/boost/include/boost/type_traits/is_base_and_derived.hpp:226:5: required from 'const bool boost::detail::is_base_and_derived_impl > > >::value'
> 226 | BOOST_STATIC_CONSTANT(bool, value = (BOOST_IS_BASE_OF(B,D) && ! ::boost::is_same::value));
> | ^~~~~~~~~~~~~~~~
> /app/boost/include/boost/type_traits/is_base_of.hpp:24:11: required from 'const bool boost::detail::is_base_of_imp > > >::value'
> 24 | BOOST_STATIC_CONSTANT(bool, value = (
> | ^~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/type_traits/is_base_of.hpp:30:48: required from 'struct boost::is_base_of > > >'
> 30 | template struct is_base_of
> | ^~~~~~~~~~
> /app/boost/include/boost/fusion/support/is_iterator.hpp:18:12: required from 'struct boost::fusion::is_fusion_iterator > > >'
> 18 | struct is_fusion_iterator : is_base_of {};
> | ^~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/mpl/if.hpp:63:11: [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
> /app/boost/include/boost/mpl/for_each.hpp:78:26: required from 'static void boost::mpl::aux::for_each_impl::execute(Iterator*, LastIterator*, TransformFunc*, F) [with Iterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::s_item > >; LastIterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::set0<> >; TransformFunc = boost::msm::wrap >; F = boost::msm::back::state_machine::init_flags]'
> 78 | aux::unwrap(f, 0)(boost::get(x));
> | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
> /app/boost/include/boost/mpl/for_each.hpp:82:22: required from 'static void boost::mpl::aux::for_each_impl::execute(Iterator*, LastIterator*, TransformFunc*, F) [with Iterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::s_item, boost::mpl::s_item > > >; LastIterator = boost::mpl::s_iter, boost::mpl::s_item > >, boost::mpl::set0<> >; TransformFunc = boost::msm::wrap >; F = boost::msm::back::state_machine::init_flags]'
> 81 | for_each_impl::value>
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 82 | ::execute( static_cast(0), static_cast(0), static_cast(0), f);
> | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/mpl/for_each.hpp:105:18: required from 'void boost::mpl::for_each(F, Sequence*, TransformOp*) [with Sequence = s_item, s_item > >; TransformOp = boost::msm::wrap >; F = boost::msm::back::state_machine::init_flags]'
> 104 | aux::for_each_impl< boost::is_same::value >
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 105 | ::execute(static_cast(0), static_cast(0), static_cast(0), f);
> | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/msm/back/state_machine.hpp:2386:29: required from 'bool (** boost::msm::back::state_machine::get_entries_for_flag() const)(const library_sm&) [with Flag = Flag1; A0 = Front; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_; flag_handler = bool (*)(const boost::msm::back::state_machine&)]'
> 2385 | (::boost::mpl::for_each >
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2386 | (init_flags(flags_entries)),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /app/boost/include/boost/msm/back/state_machine.hpp:1518:95: required from 'bool boost::msm::back::state_machine::is_flag_active() const [with Flag = Flag1; A0 = Front; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_]'
> 1518 | return FlagHelper1)>::helper(*this,get_entries_for_flag());
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
> :42:43: required from here
> 42 | std::cout << fsm.is_flag_active();
> | ~~~~~~~~~~~~~~~~~~~~~~~~~^~
> /app/boost/include/boost/mp11/detail/mpl_common.hpp:31:11: error: no type named 'type' in 'struct boost::mp11::detail::mp_pop_front_impl >'
> 31 | using next = mp11_iterator>;
> | ^~~~
>

The code:

```cpp
#include
#include
#include
#include
#include

#include

template struct Event {};
template struct Action{
void operator()(auto&& ...) {}
};
template
struct State: boost::msm::front::state<>
{
};
struct Flag1{};
struct State1 : State<1>
{
using flag_list = boost::mp11::mp_list;
// all these definition below works - so WA is easy
// using flag_list = boost::mpl::vector;
// using flag_list = boost::mpl::vector1;
// using flag_list = boost::fusion::vector;
};

struct Front : boost::msm::front::state_machine_def
{
struct transition_table : boost::mpl::vector<
boost::msm::front::Row, State<2>, Action<12>>
> {};

using initial_state = boost::mpl::vector;
};

int main() {
using Fsm = boost::msm::back::state_machine;
Fsm fsm;

fsm.start();
std::cout << fsm.is_flag_active();
}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.