Boost C++ Libraries: Ticket #9291: can not compile sink->set_filter(phoenix::bind(&my_filter, ... https://svn.boost.org/trac10/ticket/9291 <p> The line </p> <blockquote> <p> sink-&gt;set_filter(phoenix::bind(&amp;my_filter, severity, tag_attr)) </p> </blockquote> <p> from the documentation, here: <a href="http://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/tutorial/advanced_filtering.html">http://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/tutorial/advanced_filtering.html</a> fails to compile. </p> <p> *How to reproduce* </p> <p> Find this tutorial (linked from the doc above): </p> <blockquote> <p> <a href="http://www.boost.org/doc/libs/1_54_0/libs/log/example/doc/tutorial_filtering.cpp">http://www.boost.org/doc/libs/1_54_0/libs/log/example/doc/tutorial_filtering.cpp</a> </p> </blockquote> <p> Then change '#if 0' to '#if 1' to activate that part of the tutorial and comment out the other definition of init(). I get errors related to phoenix bind on line 155: </p> <blockquote> <p> sink-&gt;set_filter(phoenix::bind(&amp;my_filter, severity, tag_attr)); </p> </blockquote> <p> I can't judge if this is a problem with boost log itself or the documentation/tutorial. </p> <p> I used boost 1.54 and tried gcc 4.7.2 and 4.8.1, and tried both c++11 and c++98 mode with the same result. </p> <p> </p> <ul><li>Details on the compilation error: I think this is the relevant </li></ul><p> part of the error message: </p> <p> /myboost154/include/boost/phoenix/core/preprocessed/expression_10.hpp:140:17: error: could not convert ‘boost::proto::make_expr&lt;boost::phoenix::detail::tag::function_eval, boost::proto::domainns_::basic_default_domain, boost::phoenix::detail::function_ptr&lt;2, bool, bool (*)(const boost::log::v2_mt_posix::value_ref&lt;severity_level&gt;&amp;, const boost::log::v2_mt_posix::value_ref&lt;std::basic_string&lt;char&gt; &gt;&amp;)&gt;, boost::log::v2_mt_posix::expressions::attribute_keyword&lt;tag::severity&gt;, boost::log::v2_mt_posix::expressions::attribute_keyword&lt;tag::tag_attr&gt; </p> <blockquote class="citation"> <p> ((* &amp; a0), (* &amp; a1), (* &amp; a2))’ </p> </blockquote> <p> from ‘const type {aka const boost::proto::exprns_::basic_expr&lt;boost::phoenix::detail::tag::function_eval, boost::proto::argsns_::list3&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::detail::function_ptr&lt;2,bool, bool (*)(const boost::log::v2_mt_posix::value_ref&lt;severity_level&gt;&amp;, const boost::log::v2_mt_posix::value_ref&lt;std::basic_string&lt;char&gt;&gt;&amp;)&gt; &gt;, 0l&gt;, boost::log::v2_mt_posix::expressions::attribute_keyword&lt;tag::severity&gt;, boost::log::v2_mt_posix::expressions::attribute_keyword&lt;tag::tag_attr&gt; &gt;, 3l&gt;}’ to ‘boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::detail::function_ptr&lt;2, bool, bool (*)(const boost::log::v2_mt_posix::value_ref&lt;severity_level&gt;&amp;, const boost::log::v2_mt_posix::value_ref&lt;std::basic_string&lt;char&gt; &gt;&amp;)&gt; </p> <blockquote class="citation"> <p> , 0l&gt;::proto_child0 { </p> </blockquote> <p> aka boost::phoenix::detail::function_ptr&lt;2, bool, bool (*)(const boost::log::v2_mt_posix::value_ref&lt;severity_level&gt;&amp;, const boost::log::v2_mt_posix::value_ref&lt;std::basic_string&lt;char&gt; </p> <blockquote class="citation"> <p> &amp;)&gt;}’ }; </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9291 Trac 1.4.3 Andrey Semashev Wed, 23 Oct 2013 14:09:37 GMT <link>https://svn.boost.org/trac10/ticket/9291#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9291#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/86404" title="Refs #9291. Corrected the docs wrt the problems of using attribute ...">[86404]</a>) Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9291" title="#9291: Bugs: can not compile sink-&gt;set_filter(phoenix::bind(&amp;my_filter, ... (closed: duplicate)">#9291</a>. Corrected the docs wrt the problems of using attribute keywords with phoenix::bind or phoenix::function. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Wed, 23 Oct 2013 14:14:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9291#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9291#comment:2</guid> <description> <p> This is a known problem caused by <a class="new ticket" href="https://svn.boost.org/trac10/ticket/7996" title="#7996: Bugs: phoenix::bind does not protoify the bound arguments (new)">#7996</a>. The workaround is to explicitly specify the fallback policy in case if the attribute value is missing, for example: </p> <pre class="wiki">sink-&gt;set_filter(phoenix::bind(&amp;my_filter, severity.or_none(), tag_attr.or_none())); </pre><p> Here or_none means "pass an empty value_ref to my_filter if the attribute value is not found". </p> <p> I've updated the docs, thanks for the report. </p> </description> <category>Ticket</category> </item> <item> <author>Johan Lundberg <lundberj@…></author> <pubDate>Tue, 05 Nov 2013 21:59:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9291#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9291#comment:3</guid> <description> <p> Thank you. Works just fine. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 15 Mar 2014 12:44:56 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9291#comment:4 https://svn.boost.org/trac10/ticket/9291#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> Duplicates <a class="new ticket" href="https://svn.boost.org/trac10/ticket/7996" title="#7996: Bugs: phoenix::bind does not protoify the bound arguments (new)">#7996</a>. </p> Ticket