sml
sml copied to clipboard
Compilation error when using logger, process_queue and member function action
Expected Behavior
Compilation succeeds
Actual Behavior
Compilation fails with
error C2672: '`anonymous-namespace'::logger::log_action': no matching overloaded function found because of error C2039: 'get': is not a member of 'boost::ext::sml::v1_1_9::aux::zero_wrapper<T,void>'
Steps to Reproduce the Problem
Sample code:
#include <queue>
#include "boost/sml.hpp"
namespace sml = boost::sml;
namespace {
struct s1
{};
struct bug
{
bug() {}
auto operator()()
{
using namespace sml;
return make_transition_table(*state<s1> + event<initial> / &bug::action);
}
void action() {}
};
struct logger
{
template<class SM, class TEvent>
void log_process_event(const TEvent &)
{}
template<class SM, class TAction, class TEvent>
void log_action(const TAction &, const TEvent &)
{}
};
void test()
{
logger log;
sml::sm<bug, sml::logger<logger>, sml::process_queue<std::queue>> sm {log};
}
} // namespace
Removing sml::process_queue policy makes compilation succeed. Curiously, the no-argument constructor must be provided for compilation to succeed (= default will not do).
Specifications
- Version: v1.1.9
- Platform: Windows x64
- Compiler: MSVC 14.37.32822
- return make_transition_table(*state<s1> + event<initial> / &bug::action);
+ return make_transition_table(*state<s1> + event<initial> / wrap(&bug::action));
does the trick with SML 1.1.4 (gcc 9.4, invoked with gcc --std=c++2a)