[Boost-bugs] [Boost C++ Libraries] #9525: Assert with program termination due to context<...>() call in simple_state's entry action is incorrect

Subject: [Boost-bugs] [Boost C++ Libraries] #9525: Assert with program termination due to context<...>() call in simple_state's entry action is incorrect
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-12-26 12:58:40


#9525: Assert with program termination due to context<...>() call in
simple_state's entry action is incorrect
------------------------------+-----------------------------
 Reporter: anonymous | Owner: andreas_huber69
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: statechart
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: |
------------------------------+-----------------------------
 {{{
 #include <boost/statechart/state_machine.hpp>
 #include <boost/statechart/simple_state.hpp>

 namespace sc = boost::statechart;

 struct state;
 struct fsm : sc::state_machine<fsm, state> {
     void test() {}
 };

 struct state : sc::simple_state<state, fsm> {
     state() { context<fsm>().test(); }
 };

 int main() {
     fsm test;
     test.initiate();
 }

 }}}

 {{{
 statechart_test: /usr/include/boost/statechart/simple_state.hpp:682:
 static OtherContext& boost::statechart::simple_state<MostDerived, Context,
 InnerInitial,
 historyMode>::context_impl_other_context::context_impl(State&) [with
 OtherContext = fsm; State = boost::statechart::simple_state<state, fsm>;
 MostDerived = state; Context = fsm; InnerInitial =
 boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
 mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
 mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
 mpl_::na>; boost::statechart::history_mode historyMode =
 (boost::statechart::history_mode)0u]: Assertion `get_pointer(
 stt.pContext_ ) != 0' failed.
 ÐÐ²Ð°Ñ€Ð¸Ð¹Ð½Ñ‹Ð¹ останов
 }}}

 It's not correct to throw uncatchable surprises like asserts. It's
 especially incorrect when your library is used in the embedded software.

 Not to mention this isn't reflected anywhere in the documentation.

 Please change this to exception throwing, or better, find a way to detect
 calls like that at compile time. But don't use asserts. That's just bad
 treatment of your users.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9525>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC