boost-ext / sml

C++14 State Machine library
https://boost-ext.github.io/sml
Boost Software License 1.0
1.14k stars 177 forks source link

Template error when using unused event in ` sml::back::process<>` in action. #580

Open martinerk0 opened 1 year ago

martinerk0 commented 1 year ago

When using sml::back::process<> process_event with event that is not previously used in the table:

Example from this issue with added nani event.

return make_transition_table(
      *"established"_s + event<release>          / send_fin  = "fin wait 1"_s,
      //  "fin wait 1"_s  + event<ack> [ is_valid ]  / &tcp_release::member_action    = "fin wait 2"_s,
      "fin wait 1"_s  + event<ack> [ is_valid ]  / []() {&tcp_release::member_action;}    = "fin wait 2"_s,
       "fin wait 2"_s  + event<fin> [ is_valid ] / send_ack  = "timed wait"_s,
      //  "fin wait 2"_s  + event<nani> [ is_valid ] / send_ack  = "timed waitt"_s, // won't compile
       "s1"_s + event<ack> / [this](sml::back::process<fin,nani> process_event) {
            calls += "a1.begin|";
            process_event(ack{});
            process_event(fin{});
            calls += "a1.end|";
          }   = "fin wait 2"_s,
       "timed wait"_s  + event<timeout>                      = X
    );

Expected Behavior

Maybe update documentation that you have to use events in table before you use it in action.

Actual Behavior

compile error with template argument deduction/substitution failed:

Specifications