Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/boost/sml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3135,7 +3135,7 @@ struct transition<state<S1>, state<S2>> : transition<state<S1>, state<S2>, front
template <class S2, class G>
struct transition_sg<state<S2>, G> : transition<state<internal>, state<S2>, front::event<back::anonymous>, G, none> {
using transition<state<internal>, state<S2>, front::event<back::anonymous>, G, none>::g;
transition_sg(const state<S2> &, const G &g_init)
constexpr transition_sg(const state<S2> &, const G &g_init)
: transition<state<internal>, state<S2>, front::event<back::anonymous>, G, none>{g_init, none{}} {}
template <class T>
constexpr auto operator/(const T &t) const {
Expand All @@ -3149,7 +3149,7 @@ struct transition_sg<state<S2>, G> : transition<state<internal>, state<S2>, fron
template <class S2, class A>
struct transition_sa<state<S2>, A> : transition<state<internal>, state<S2>, front::event<back::anonymous>, always, A> {
using transition<state<internal>, state<S2>, front::event<back::anonymous>, always, A>::a;
transition_sa(const state<S2> &, const A &a_init)
constexpr transition_sa(const state<S2> &, const A &a_init)
: transition<state<internal>, state<S2>, front::event<back::anonymous>, always, A>{always{}, a_init} {}
template <class T>
constexpr auto operator=(const T &) const {
Expand Down
22 changes: 22 additions & 0 deletions test/ft/constexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace sml = boost::sml;
struct e1 {};

const auto idle = sml::state<class idle>;
const auto s1 = sml::state<class s1>;
const auto s2 = sml::state<class s2>;

test constexpr_sm = [] {
using namespace sml;
Expand All @@ -37,3 +39,23 @@ test constexpr_sm = [] {

static_assert(test());
};

test constexpr_anonymous_transitions_sm = [] {
using namespace sml;
struct c {
// clang-format off
constexpr auto operator()() noexcept {
const auto guard = [] { return true; };
const auto action = [] {};
return make_transition_table(
*idle + event<e1> = s1,
s1[guard] = s2,
s2 / action = X
);
}
// clang-format on
};

constexpr sml::sm<c, sml::dispatch<sml::back::policies::branch_stm>> sm{};
(void)sm;
};
Loading