[Boost-bugs] [Boost C++ Libraries] #3117: BOOST_CHECK requires !!x, fails if x is convertible to bool and disables operator!

Subject: [Boost-bugs] [Boost C++ Libraries] #3117: BOOST_CHECK requires !!x, fails if x is convertible to bool and disables operator!
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-06-01 07:15:48


#3117: BOOST_CHECK requires !!x, fails if x is convertible to bool and disables
operator!
--------------------------+-------------------------------------------------
 Reporter: daniel_frey | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: test
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
 BOOST_CHECK( x ) requires !!x to be convertible to bool, although it
 should only require x to be convertible to bool. The problem can be seen
 in libs/utility/operators_test.cpp:661, where I had to convert the result
 of the comparison explicitly (as well as in many other places in this
 file).

 The offending code is found in boost/test/predicate_result.hpp:53, and I
 don't actually see why this constructor is needed at all. It actually only
 makes sense for types which are ''not'' convertible to bool directly, but
 only through double negation.

 I suggest to remove the constructor at line 53/54. If it breaks something,
 it means that this something is not convertible to bool and it should be
 fixed, instead of relying on BOOST_TEST to apply double negation.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3117>
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:00 UTC