[Boost-bugs] [Boost C++ Libraries] #11549: ostream& operator<< overload no longer picked up by boost log

Subject: [Boost-bugs] [Boost C++ Libraries] #11549: ostream& operator<< overload no longer picked up by boost log
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-08-18 10:42:31


#11549: ostream& operator<< overload no longer picked up by boost log
------------------------------+------------------------
 Reporter: dd0t@… | Owner: andysem
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: log
  Version: Boost 1.59.0 | Severity: Regression
 Keywords: |
------------------------------+------------------------
 Boost log does no longer seem to reliably pick up custom stream operators
 in boost 1.59.0 (tested with vc14 and vc12). In the example given below
 the custom operator works fine for cout but isn't found when trying to use
 it normally for logging. The operator is however found if something else
 is piped in first. Compiling the same example with 1.58.0 (only tested
 with vc12) works as expected.

 {{{
 #include <iostream>
 #include <ostream>
 #include <boost/log/trivial.hpp>

 struct Mine {};

 std::ostream& operator << (std::ostream& t, const Mine& m) {
         t << "Works";
         return t;
 };

 int main() {
         Mine m;
         std::cout << m << std::endl; // Works
         BOOST_LOG_TRIVIAL(warning) << m; // error C2678: binary '<<': no
 operator found which takes a left-hand operand of type
 'boost::log::v2s_mt_nt5::basic_record_ostream<char>' (or there is no
 acceptable conversion)
         BOOST_LOG_TRIVIAL(warning) << "" << m; // Works
         return 0;
 };
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11549>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC