Opened 9 years ago
Last modified 9 years ago
#9508 new Bugs
1.54 regression: boost/thread/once.hpp includes boost/placeholders.hpp
| Reported by: | Owned by: | Peter Dimov | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | bind |
| Version: | Boost 1.54.0 | Severity: | Regression |
| Keywords: | Cc: |
Description
#include <functional> #include <boost/thread/once.hpp> using namespace std::placeholders; static int x = sizeof(_1);
The code above compiles in C++11 mode on boost 1.53, but it fails on boost 1.54 like this:
boost_bind_bug.cpp:6:23: error: reference to ‘_1’ is ambiguous
static int x = sizeof(_1);
^
In file included from boost_bind_bug.cpp:1:0:
/usr/include/c++/4.8.2/functional:1004:34: note: candidates are: const std::_Placeholder<1> std::placeholders::_1
extern const _Placeholder<1> _1;
^
In file included from /usr/include/boost/bind/bind.hpp:1742:0,
from /usr/include/boost/bind.hpp:22,
from /usr/include/boost/thread/pthread/once_atomic.hpp:19,
from /usr/include/boost/thread/once.hpp:20,
from boost_bind_bug.cpp:2:
/usr/include/boost/bind/placeholders.hpp:55:15: note: boost::arg<1> {anonymous}::_1
boost::arg<1> _1;
^
This magic inclusion of boost/bind/placeholders.hpp is extremely impolite.
Note:
See TracTickets
for help on using tickets.

Well, Boost.Thread uses boost::bind, so I don't see where is the problem. The problem is that _1 is on the global namespace.
Moved to bind.