Opened 7 years ago
Last modified 7 years ago
#11702 new Bugs
boost::bind universal reference handling regression
| Reported by: | Owned by: | Peter Dimov | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | bind |
| Version: | Boost 1.59.0 | Severity: | Regression |
| Keywords: | bind, auto_ptr | Cc: |
Description
The following code compiles with boost-1.57 but not with boost-1.59:
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <memory>
void foo(std::auto_ptr<int>);
int main() {
boost::function<void(std::auto_ptr<int>)> f = boost::bind(foo, _1);
std::auto_ptr<int> p;
f(p);
}
This is due to the new universal reference handling code implemented in boost::bind.
The local fix we use is:
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
namespace boost { namespace _bi {
template<class A> struct list_add_cref<std::auto_ptr<A> >
{
typedef std::auto_ptr<A>& type;
};
} }
#endif
Note:
See TracTickets
for help on using tickets.

Should be fixed in https://github.com/boostorg/bind/commit/017258c983c18f86641788e840526a7f82af6370