[Boost-bugs] [Boost C++ Libraries] #12621: property_tree::read_json does not work with BOOST_BIND_NO_PLACEHOLDERS

Subject: [Boost-bugs] [Boost C++ Libraries] #12621: property_tree::read_json does not work with BOOST_BIND_NO_PLACEHOLDERS
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-11-24 14:35:16


#12621: property_tree::read_json does not work with BOOST_BIND_NO_PLACEHOLDERS
------------------------------+---------------------------
 Reporter: ja2222ja@… | Owner: cornedbee
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: property_tree
  Version: Boost 1.61.0 | Severity: Regression
 Keywords: |
------------------------------+---------------------------
 Minimal code example:
 {{{
 #define BOOST_BIND_NO_PLACEHOLDERS
 #include <boost/property_tree/json_parser.hpp>
 #include <functional>
 using namespace std::placeholders;

 int main () {
     boost::property_tree::ptree pt;
     boost::property_tree::read_json("lol", pt);
 }
 }}}

 Visual Studio 2015 Update 3 with v120 toolkit generates:
 {{{
 \lib\native\include\boost\bind\bind.hpp(319): error C2664: 'void
 boost::_mfi::mf1<void,boost::property_tree::json_parser::detail::standard_callbacks<Ptree>,char>::operator
 ()(T *,A1) const' : cannot convert argument 2 from 'std::_Ph<1>' to 'char'
 1> with
 1> [
 1> Ptree=boost::property_tree::ptree
 1> ,
 T=boost::property_tree::json_parser::detail::standard_callbacks<boost::property_tree::ptree>
 1> , A1=char
 1> ]
 1> No user-defined-conversion operator available that can perform
 this conversion, or the operator cannot be called
 }}}

 First affected version: 1.59 [which introduces the new json parser]

 My investigation shows that
 {{{property_tree::json_parser::detail::standard_callbacks::operator()}}}
 uses unqualified {{{_1}}} symbol. Since {{{#define
 BOOST_BIND_NO_PLACEHOLDERS}}} is used, compiler don't know nothing about
 {{{_1}}}.

 Error msg generated in msvc shows that {{{boost::bind}}} is messed up with
 {{{std::placeholders::_1}}}. The problem might be causes by no two-phase-
 lookup in {{{cl}}}. {{{using namespace std::placeholders}}} affects
 mentioned {{{_1}}} usage in {{{operator()}}} since lookup for non
 dependent {{{_1}}} is done later. Fixing issue in boost should workaround
 the msvc issue.

 Please note that without {{{#define BOOST_BIND_NO_PLACEHOLDERS}}}
 everything works ok.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12621>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC