Opened 5 years ago
#12998 new Bugs
Can't forward single-argument constructors to sinks
Reported by: | Owned by: | Andrey Semashev | |
---|---|---|---|
Milestone: | To Be Determined | Component: | log |
Version: | Boost 1.63.0 | Severity: | Problem |
Keywords: | Cc: |
Description
CasparCG has code like this:
`
class sink_backend : public boost::log::sinks::basic_formatted_sink_backend<char> {
std::function<void(std::string line)> formatted_line_sink_;
public:
sink_backend(std::function<void(std::string line)> formatted_line_sink)
: formatted_line_sink_(std::move(formatted_line_sink))
{ }
void consume(const boost::log::record_view& rec, const std::string& formatted_message) {
try {
formatted_line_sink_(formatted_message);
} catch (...) {
std::cerr << "[sink_backend] Error while consuming formatted message: " << formatted_message << std::endl << std::endl;
}
}
};
[…]
auto sink = boost::make_shared<sink_type>(std::move(formatted_line_sink));
`
This fails with a long spew of template errors, evidently because for single-argument constructors, only variants with named parameters are considered (sync_frontend.hpp, BOOST_LOG_SINK_CTOR_FORWARD_INTERNAL_1). This is a regression from 1.59.0.
Adding a dummy int parameter and setting it to 0 makes the code compile.