Modify

Opened 2 years ago

Last modified 2 years ago

#11702 new Bugs

boost::bind universal reference handling regression

Reported by: maxim.yegorushkin@… 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

Attachments (0)

Change History (1)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Peter Dimov.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.