boostorg / boostorg/statechart
Multiple orthogonal state components reacting to the same event can result in incorrect state transition
- Dominant language
- C++
- Stars
- 32
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
Consider an example state machine:

```c++
#include
#include
#include
#include
#include
struct Main;
struct A0;
struct B0;
struct A1;
struct B1;
struct Event : boost::statechart::event {};
struct Machine : boost::statechart::state_machine {};
struct Main : boost::statechart::simple_state> {};
struct A0 : boost::statechart::simple_state>
{
using reactions = boost::statechart::transition;
A0() { std::cout << "Enter A0" << std::endl; }
~A0() { std::cout << "Exit A0" << std::endl; }
};
struct B0 : boost::statechart::simple_state>
{
B0() { std::cout << "Enter B0" << std::endl; }
~B0() { std::cout << "Exit B0" << std::endl; }
};
struct A1 : boost::statechart::simple_state>
{
using reactions = boost::statechart::transition;
A1() { std::cout << "Enter A1" << std::endl; }
~A1() { std::cout << "Exit A1" << std::endl; }
};
struct B1 : boost::statechart::simple_state>
{
B1() { std::cout << "Enter B1" << std::endl; }
~B1() { std::cout << "Exit B1" << std::endl; }
};
int main(int, char**)
{
Machine machine;
machine.initiate();
machine.process_event(Event {});
return 0;
}
```
Running the example outputs:
```
Enter A0
Enter A1
Exit A0
Enter B0
Exit A1
Exit B0
```
The machine transitions (A0, A1)->(B0, A1), although the correct transition is (A0, A1)->(B0, B1).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.