Hello,
The following minimized program works under 1.57 but no longer under 1.60, as the second bind results in calling of a member function with nullptr at run-time. Is the code mal-formed? Is it a boost bind bug? It still works fine with raw pointers, but no
longer works correctly with boost::shared_ptr. Same result with gcc 4.8.1 and gcc 6.1.0 on Linux.
Thanks,
Jason
-------------------
#include <stdio.h>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
struct Boom {
bool Oops() const { printf("Boom::Oops @ %p\n", this); return true; }
};
int main() {
boost::shared_ptr<const Boom> obj = boost::make_shared<Boom>();
using tMatcher = boost::function<bool(boost::shared_ptr<const Boom>)>;
tMatcher Func = boost::bind(&Boom::Oops, _1);
Func = boost::bind(Func, _1) && boost::bind(&Boom::Oops, _1);
Func(obj);
}
-------------------
Expected output:
Boom::Oops @ 0x11f6d79
Boom::Oops @ 0x11f6d79
Actual output:
Boom::Oops @ 0x11f6d79
Boom::Oops @ (nil)
-------------------