Boost C++ Libraries: Ticket #3117: BOOST_CHECK requires !!x, fails if x is convertible to bool and disables operator! https://svn.boost.org/trac10/ticket/3117 <p> 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). </p> <p> 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 <em>not</em> convertible to bool directly, but only through double negation. </p> <p> 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. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3117 Trac 1.4.3 Gennadiy Rozental Sat, 06 Jun 2009 09:46:22 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3117#comment:1 https://svn.boost.org/trac10/ticket/3117#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Boost.Test is C++ library. No need for macro. I've changed C style casts inside Boost.Test code. there might be still some coming from other components or system headers </p> Ticket Gennadiy Rozental Sat, 06 Jun 2009 09:46:57 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/3117#comment:2 https://svn.boost.org/trac10/ticket/3117#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> wrong ticket </p> Ticket Gennadiy Rozental Sat, 06 Jun 2009 09:59:00 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3117#comment:3 https://svn.boost.org/trac10/ticket/3117#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> I am inclined to leave it as is. Double negation is rather popular pattern and in majority of the cases does the right thing. I guess there is something special about your operator!, but you can always cast to bool explicitly. </p> <p> So, unless if you can come up with the way to continue support types with only operator! implemented (using enable_if or something) we probably should keep it as is. </p> Ticket