id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 13632,boost::function operator== is bugged on FreeBSD 11.2,hongli@…,Douglas Gregor,"The Passenger application server is a C++ application and uses Boost. Our FreeBSD 11.2 users ran into a crash bug: https://github.com/phusion/passenger/issues/2097 Upon further investigation, it turns out that the underlying problem is boost::function operator==. The following test program... {{{ boost::function f; printf(""is null: %d\n"", f == NULL); }}} ...prints 1 on macOS (as it should) and 0 on FreeBSD 11.2. I haven't tested this small test program on FreeBSD 11.1, but users reported that Passenger worked fine on FreeBSD 11.1 so the problem likely did not exist there. Digger deeper, on FreeBSD the == operator calls this function (in boost/function/function_base.hpp): {{{ # if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) // Comparisons between boost::function objects and arbitrary function // objects. GCC 3.3 and before has an obnoxious bug that prevents this // from working. template BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) operator==(const function_base& f, Functor g) { if (const Functor* fp = f.template target()) return function_equal(*fp, g); else return false; } }}} ...and returns false (the else branch). While on macOS it calls this function: {{{ inline bool operator!=(const function_base& f, detail::function::useless_clear_type*) { return !f.empty(); } }}} Just looking at the #if there already gives me the feeling that it is not right. Boost is trying to work around a GCC 3 bug but it wrongly detects Clang 6.0.0 as GCC 3. This bug has been confirmed on both Boost 1.64 and Boost 1.67.",Bugs,new,To Be Determined,function,Boost 1.67.0,Problem,,,