erikzenker / hsm

Finite state machine library based on the boost hana meta programming library. It follows the principles of the boost msm and boost sml libraries, but tries to reduce own complex meta programming code to a minimum.
MIT License
187 stars 18 forks source link

[BUG] MSVC dispatch table injection fails to compile #155

Closed erikzenker closed 2 years ago

erikzenker commented 3 years ago

Describe the bug MSVC fails to compile if constexpr branches even if the condition for the branch does not evaluate to true.

This is needed to sm.h:

  if constexpr (has_anonymous_transition(rootState)) {
  ...
  auto& result = get_dispatch_table_entry(event, region);
  ...
  }

To Reproduce Compiles on clang: https://godbolt.org/z/e3KcYv Does not compile on msvc: https://godbolt.org/z/ab3bdPj91

Expected behavior Compiles.

Additional context A workaround could be to add some kind of a dummy next state for the none event.

erikzenker commented 2 years ago

windows-ci-error.log

erikzenker commented 2 years ago

Fixed by #173