
Hello, Should the following code sample work? It is the simplest reproduction case I could come up with: #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #include <boost/shared_ptr.hpp> #include <stdlib.h> using namespace std; using namespace boost; using namespace boost::lambda; int main(void) { void * myResource = malloc(5); shared_ptr<void> mySharedResource(myResource, bind(free, _1)); } I get a compile error using g++ 4.0.1 on Mac OS X: /Documents/boost_1_34_0/boost/detail/sp_counted_impl.hpp: In member function 'void* boost::detail::sp_counted_impl_pd<P, D>::get_deleter(const std::type_info&) [with P = void*, D = boost::lambda::lambda_functor<boost::lambda:: lambda_functor_base<boost::lambda:: action<2, boost::lambda::function_action<2, void> >, boost::tuples::tuple<void (&)(void*), const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >]': test.cpp:13: instantiated from here /Documents/boost_1_34_0/boost/detail/sp_counted_impl.hpp:150: error: no match for ternary 'operator?:' in '(+ ti)->std::type_info::operator==(((const std::type_info&)((const std::type_info*)(& _ZTIN5boost6lambda14lambda_functorINS0_19lambda_functor_baseINS0_6action ILi2ENS0 _15function_actionILi2EvEEEENS_6tuples5tupleIRFvPvEKNS1_INS0_11placehold erILi1EE EEENS7_9null_typeESG_SG_SG_SG_SG_SG_SG_EEEEEE)))) ? boost::lambda::operator&(const boost::lambda::lambda_functor<T>&) [with Arg = boost::lambda::lambda_functor_base<boost::lambda::action<2, boost::lambda::function_action<2, void> >, boost::tuples::tuple<void (&)(void*), const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >]() : 0' Of course, just using "free" instead of bind(free, _1) works, but my real case is more complicated and this appears to be a general conflict between lambda::bind and shared_ptr. Thanks, Scott French