id summary reporter owner description type status milestone component version severity resolution keywords cc 7996 phoenix::bind does not protoify the bound arguments Andrey Semashev Thomas Heller "I have a problem with Boost.Phoenix v3 bind implementation when used with attribute keywords from Boost.Log. For some reason phoenix::bind does not apply proto::detail::protoify to the bound arguments which breaks compilation of some formatting expressions in Boost.Log. Here's an example: {{{ #include #include #include #include namespace logging = boost::log; namespace expr = boost::log::expressions; namespace phoenix = boost::phoenix; // Custom severity level formatting function std::string severity_level_as_urgency( logging::value_ref< logging::trivial::severity_level, logging::trivial::tag::severity > const& level) { if (!level || level.get() == logging::trivial::info) return ""normal""; logging::trivial::severity_level lvl = level.get(); if (lvl < logging::trivial::info) return ""low""; else return ""critical""; } int main(int, char*[]) { logging::formatter fmt = expr::stream << boost::phoenix::bind(&severity_level_as_urgency, logging::trivial::severity); return 0; } }}} The example creates a formatter function object that should call severity_level_as_urgency function to convert the severity level to string and put its result into a stream. trivial::severity is a keyword of type expr::attribute_keyword< ... >. Keywords themselves should never actually be embedded into phoenix expressions, instead I have attribute_actor that implements all the necessary work to extract attribute values. I have specialized proto::detail::protoify template for attribute_keyword (including references and reference_wrappers thereof) so that it is automatically converted to attribute_actor whenever it participates in expressions. But it doesn't work with the above code, Boost.Phoenix embeds attribute_keyword as is into the expression. This results in the error I attached to the ticket. I realize that proto::detail::protoify is not for public use and may not be intended for my use case but I did not find any other way to implement what I described. Anyway, I think bind should treat bound arguments as child subexpressions and protoify them. To compile the test code you will have to checkout Boost.Log from SVN: {{{ svn co https://boost-log.svn.sourceforge.net/svnroot/boost-log/branches/bleeding-edge -r 822 boost-log }}} Then the relevant directories have to be linked/copied into the Boost tree. PS: The issue came from the mailing list: [http://lists.boost.org/Archives/boost/2013/02/200701.php] " Bugs new To Be Determined phoenix Boost Release Branch Problem phoenix bind proto log