Opened 8 years ago

Last modified 8 years ago

#10722 reopened Bugs

msm gives compilation errors when using state machine constructors with arguments

Reported by: Marek Glos <marekglos@…> Owned by: Christophe Henry
Milestone: Component: msm
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

This code compiles fine with boost 1.55.0 but fails on 1.56.0. Checked on MSVC2012 and gcc.

#include <boost/msm/back/state_machine.hpp>         // back-end
#include <boost/msm/back/tools.hpp>
#include <boost/msm/front/state_machine_def.hpp>    // front-end
#include <boost/msm/front/functor_row.hpp>
#include <boost/msm/front/euml/operator.hpp>

namespace msm = boost::msm;
namespace mpl = boost::mpl;
using namespace msm::front;

struct Substate : public msm::front::state<> { };

struct State_ : public msm::front::state_machine_def<State_>
{
    State_(int) {}
    State_() {}

        struct transition_table : mpl::vector<
        //   Start        Event         Next         Action      Guard
        //  +------------+-------------+------------+-----------+------------+
        Row < Substate   , none        , none       , none      , none       >
    > {};

    typedef Substate initial_state;
};
typedef msm::back::state_machine<State_> State;


// machine itself
struct TestFSM_ : public msm::front::state_machine_def<TestFSM_>
{
    TestFSM_(int) {}
    TestFSM_() {}

    struct transition_table : mpl::vector<
        //   Start        Event          Next         Action      Guard
        //  +------------+--------------+------------+-----------+-----------+
        Row < State      , none         , none       , none      , none      >
    > {};

    typedef State initial_state;
};
typedef msm::back::state_machine<TestFSM_> TestFSM;

void start()
{
    TestFSM(msm::back::states_ << State(10), 10);
}

Error output from MSVC2012 looks like this:

1>  test.cpp
1>c:\test\boost\boost\core\enable_if.hpp(36): error C2039: 'value' : is not a member of 'boost::is_convertible<From,To>'
1>          with
1>          [
1>              From=boost::fusion::vector1<boost::msm::back::state_machine<State_>>,
1>              To=boost::msm::back::state_machine<State_>
1>          ]
1>          c:\test\boost\boost\type_traits\is_convertible.hpp(486) : see reference to class template instantiation 'boost::enable_if<Cond,T>' being compiled
1>          with
1>          [
1>              Cond=boost::is_convertible<boost::fusion::vector1<boost::msm::back::state_machine<State_>>,boost::msm::back::state_machine<State_>>,
1>              T=void
1>          ]
1>          c:\test\boost\boost\core\enable_if.hpp(59) : see reference to class template instantiation 'boost::is_convertible<From,To>' being compiled
1>          with
1>          [
1>              From=boost::fusion::vector1<boost::msm::back::state_machine<State_>>,
1>              To=boost::msm::back::state_machine<State_>
1>          ]
1>          c:\test\boost\boost\fusion\container\vector\convert.hpp(46) : see reference to class template instantiation 'boost::disable_if<Cond,T>' being compiled
1>          with
1>          [
1>              Cond=boost::is_convertible<boost::fusion::vector1<boost::msm::back::state_machine<State_>>,boost::msm::back::state_machine<State_>>,
1>              T=void
1>          ]
1>          c:\test\boost\boost\msm\back\state_machine.hpp(1564) : see reference to function template instantiation 'boost::fusion::vector1<T0> boost::fusion::as_vector<boost::fusion::cons<Car,Cdr>>(const Sequence &)' being compiled
1>          with
1>          [
1>              T0=boost::msm::back::state_machine<State_>,
1>              Car=boost::msm::back::state_machine<State_>,
1>              Cdr=boost::fusion::nil_,
1>              Sequence=boost::fusion::cons<boost::msm::back::state_machine<State_>,boost::fusion::nil_>
1>          ]
1>          c:\test\boost\boost\msm\back\state_machine.hpp(1655) : see reference to function template instantiation 'void boost::msm::back::state_machine<A0>::set_states<Expr>(const Expr &)' being compiled
1>          with
1>          [
1>              A0=TestFSM_,
1>              Expr=boost::msm::msm_terminal<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left,boost::proto::argsns_::list2<const boost::msm::back::define_states_creation<> &,boost::msm::msm_terminal<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const boost::msm::back::state_machine<State_> &>,0>>>,2>>
1>          ]
1>          c:\test\boost\boost\msm\back\state_machine.hpp(1655) : see reference to function template instantiation 'void boost::msm::back::state_machine<A0>::set_states<Expr>(const Expr &)' being compiled
1>          with
1>          [
1>              A0=TestFSM_,
1>              Expr=boost::msm::msm_terminal<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left,boost::proto::argsns_::list2<const boost::msm::back::define_states_creation<> &,boost::msm::msm_terminal<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const boost::msm::back::state_machine<State_> &>,0>>>,2>>
1>          ]
1>          c:\test\ffc\audioextractor\dataanalyzer\engines\test.cpp(47) : see reference to function template instantiation 'boost::msm::back::state_machine<A0>::state_machine<boost::msm::msm_terminal<Expr>,int>(const boost::msm::msm_terminal<Expr> &,ARG0,void *)' being compiled
1>          with
1>          [
1>              A0=TestFSM_,
1>              Expr=boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left,boost::proto::argsns_::list2<const boost::msm::back::define_states_creation<> &,boost::msm::msm_terminal<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const boost::msm::back::state_machine<State_> &>,0>>>,2>,
1>              ARG0=int
1>          ]
1>          c:\test\ffc\audioextractor\dataanalyzer\engines\test.cpp(47) : see reference to function template instantiation 'boost::msm::back::state_machine<A0>::state_machine<boost::msm::msm_terminal<Expr>,int>(const boost::msm::msm_terminal<Expr> &,ARG0,void *)' being compiled
1>          with
1>          [
1>              A0=TestFSM_,
1>              Expr=boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left,boost::proto::argsns_::list2<const boost::msm::back::define_states_creation<> &,boost::msm::msm_terminal<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const boost::msm::back::state_machine<State_> &>,0>>>,2>,
1>              ARG0=int
1>          ]
1>c:\test\boost\boost\core\enable_if.hpp(36): error C2065: 'value' : undeclared identifier
1>c:\test\boost\boost\core\enable_if.hpp(36): error C2975: 'B' : invalid template argument for 'boost::enable_if_c', expected compile-time constant expression
1>          c:\test\boost\boost\core\enable_if.hpp(27) : see declaration of 'B'

Change History (3)

comment:1 by Christophe Henry, 8 years ago

Milestone: To Be DeterminedBoost 1.57.0
Resolution: fixed
Status: newclosed

This works in develop (and therefore 1.57). Can you confirm?

in reply to:  1 comment:2 by Marek Glos <marekglos@…>, 8 years ago

I've tried with boost 1.57.0 b1 with MSVC2012 and problem still occures. Can you reopen this?

comment:3 by Marek Glos <marekglos@…>, 8 years ago

Milestone: Boost 1.57.0
Resolution: fixed
Status: closedreopened
Version: Boost 1.56.0Boost 1.57.0
Note: See TracTickets for help on using tickets.