hi everyone, I had a look at this compilation error (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811849), and managed to reduce the problem to a much smaller case:
----------------------------8<------------------------------ #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> #include <boost/core/noncopyable.hpp> #include <boost/function.hpp> // fails to compile with g++-6 in a manner similar to // https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811849 // works with g++-5 class argument { }; class test : private boost::noncopyable { public: void member(void); // note that the shared_ptr is passed by reference! is passing a // shared_ptr by reference even safe? it so, does it not need to // be // const? void callback(boost::shared_ptr<argument>& cb); }; // but that this declaration is without the reference! putting it in // makes it // work in g++-6 as well, but see above about the question whether this // is safe typedef boost::function1<void, boost::shared_ptr<argument> > callback_type; void recipient(callback_type cb) { } void test::member(void) { recipient(boost::bind(&test::callback, this, _1)); } ---------------------------->8------------------------------ to me it seems that the problem is that the shared_ptr is passed to the callback by reference, which seems to be different from the callback type expectations, and which sounds like a dangerous way to use a shared_ptr anyway, at least to me. for kicks I modified finish_connection() in pion::tcp::server to take a non-reference argument, and that makes this particular class compile with g++-6. there are similar cases in http::server which can be made to compile the same way, but which also raises the question why this usage of a shared_ptr is a problem for connection_ptr, but nor request_ptr. there appear to be other compilation problems, but one at a time... regards robert -- Robert Lemmen http://www.semistable.com
signature.asc
Description: PGP signature