Re: [Boost-bugs] [Boost C++ Libraries] #13007: When BOOST_BIND_NO_PLACEHOLDERS is defined, framework.ipp seems to be missing an #include

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13007: When BOOST_BIND_NO_PLACEHOLDERS is defined, framework.ipp seems to be missing an #include
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-07 21:21:50


#13007: When BOOST_BIND_NO_PLACEHOLDERS is defined, framework.ipp seems to be
missing an #include
---------------------------+-----------------------------
  Reporter: bspencer@… | Owner: Raffi Enficiaud
      Type: Bugs | Status: assigned
 Milestone: Boost 1.65.0 | Component: test
   Version: Boost 1.64.0 | Severity: Problem
Resolution: | Keywords:
---------------------------+-----------------------------

Comment (by bspencer@…):

 It seems that this only happens with some toolchains. For example,
 consider the following program, which works if
 `BOOST_BIND_NO_PLACEHOLDERS` is defined, but fails to compile otherwise
 (at least with some toolchains):

 {{{
 //#define BOOST_BIND_NO_PLACEHOLDERS
 #include <boost/bind.hpp>
 #include <functional>
 #include <cstdio>

 using namespace std::placeholders;

 int main()
 {
   const auto g = std::bind(std::puts, _1);
   g("Hello, world!");
 }
 }}}

 With gcc-4.9 (admittedly old, but still important for some targets):
 {{{
 $ g++ -Wall -std=c++11 -c -o foo.o foo.cc -I boost_1_64_0
 foo.cc: In function ‘int main()’:
 foo.cc:10:39: error: reference to ‘_1’ is ambiguous
    const auto g = std::bind(std::puts, _1);
                                        ^
 In file included from /usr/include/c++/4.9/memory:79:0,
                  from boost_1_64_0/boost/config/no_tr1/memory.hpp:21,
                  from boost_1_64_0/boost/get_pointer.hpp:14,
                  from boost_1_64_0/boost/bind/mem_fn.hpp:25,
                  from boost_1_64_0/boost/mem_fn.hpp:22,
                  from boost_1_64_0/boost/bind/bind.hpp:26,
                  from boost_1_64_0/boost/bind.hpp:22,
                  from foo.cc:2:
 /usr/include/c++/4.9/functional:972:34: note: candidates are: const
 std::_Placeholder<1> std::placeholders::_1
      extern const _Placeholder<1> _1;
                                   ^
 In file included from boost_1_64_0/boost/bind/bind.hpp:2319:0,
                  from boost_1_64_0/boost/bind.hpp:22,
                  from foo.cc:2:
 boost_1_64_0/boost/bind/placeholders.hpp:46:38: note:
 constexpr const boost::arg<1> boost::placeholders::_1
  BOOST_STATIC_CONSTEXPR boost::arg<1> _1;
 ^
 }}}

 Using an online version of gcc-7 at coliru.stacked-crocked.com, it fails
 in the same way. (I can't post a link or Trac calls this post spam).

 I don't see this with modern clang, but gcc-7 is pretty new, so there
 still seems to be a reason to set `BOOST_BIND_NO_PLACEHOLDERS`.

 BTW, I thought I remembered `BOOST_BIND_NO_PLACEHOLDERS` being documented
 in `config/user.hpp`, but it seems I was mistaken about that, at least in
 1.64.0.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13007#comment:6>
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-07-07 21:26:17 UTC