Boost C++ Libraries: Ticket #12621: property_tree::read_json does not work with BOOST_BIND_NO_PLACEHOLDERS https://svn.boost.org/trac10/ticket/12621 <p> Minimal code example: </p> <pre class="wiki">#define BOOST_BIND_NO_PLACEHOLDERS #include &lt;boost/property_tree/json_parser.hpp&gt; #include &lt;functional&gt; using namespace std::placeholders; int main () { boost::property_tree::ptree pt; boost::property_tree::read_json("lol", pt); } </pre><p> Visual Studio 2015 Update 3 with v120 toolkit generates: </p> <pre class="wiki">\lib\native\include\boost\bind\bind.hpp(319): error C2664: 'void boost::_mfi::mf1&lt;void,boost::property_tree::json_parser::detail::standard_callbacks&lt;Ptree&gt;,char&gt;::operator ()(T *,A1) const' : cannot convert argument 2 from 'std::_Ph&lt;1&gt;' to 'char' 1&gt; with 1&gt; [ 1&gt; Ptree=boost::property_tree::ptree 1&gt; , T=boost::property_tree::json_parser::detail::standard_callbacks&lt;boost::property_tree::ptree&gt; 1&gt; , A1=char 1&gt; ] 1&gt; No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called </pre><p> First affected version: 1.59 [which introduces the new json parser] </p> <p> My investigation shows that <code>property_tree::json_parser::detail::standard_callbacks::operator()</code> uses unqualified <code>_1</code> symbol. Since <code>#define BOOST_BIND_NO_PLACEHOLDERS</code> is used, compiler don't know nothing about <code>_1</code>. </p> <p> Error msg generated in msvc shows that <code>boost::bind</code> is messed up with <code>std::placeholders::_1</code>. The problem might be causes by no two-phase-lookup in <code>cl</code>. <code>using namespace std::placeholders</code> affects mentioned <code>_1</code> usage in <code>operator()</code> since lookup for non dependent <code>_1</code> is done later. Fixing issue in boost should workaround the msvc issue. </p> <p> Please note that without <code>#define BOOST_BIND_NO_PLACEHOLDERS</code> everything works ok. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12621 Trac 1.4.3 Agustín K-ballo Bergé <kaballo86@…> Thu, 24 Nov 2016 14:36:38 GMT cc set https://svn.boost.org/trac10/ticket/12621#comment:1 https://svn.boost.org/trac10/ticket/12621#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">kaballo86@…</span> added </li> </ul> Ticket ja2222ja@… Thu, 24 Nov 2016 14:40:05 GMT <link>https://svn.boost.org/trac10/ticket/12621#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12621#comment:2</guid> <description> <p> Error msg from gcc: </p> <pre class="wiki">/usr/local/boost-1.62.0/include/boost/property_tree/json_parser/detail/parser.hpp: In member function 'void boost::property_tree::json_parser::detail::string_callback_adapter&lt;Callbacks, Encoding, Iterator, std::input_iterator_tag&gt;::process_codepoint(Sentinel, EncodingErrorFn)': /usr/local/boost-1.62.0/include/boost/property_tree/json_parser/detail/parser.hpp:217:52: error: '_1' was not declared in this scope boost::ref(callbacks), _1), </pre> </description> <category>Ticket</category> </item> </channel> </rss>