Boost logo

Boost :

Subject: Re: [boost] [teeks99][test] Test failures on MSVC 8-11
From: Bjorn Reese (breese_at_[hidden])
Date: 2015-11-22 11:21:10


On 11/21/2015 09:54 PM, Raffi Enficiaud wrote:

> #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
> static std::map<char,char const*> const char_type{{
> {'<' , "lt"},
> {'>' , "gt"},
> {'&' , "amp"},
> {'\'', "apos"},
> {'"' , "quot"}
> }};
> #else /.../

I would replace the std::map with a switch statement in this case. Then
there is no need for an #ifndef.

>> http://www.boost.org/development/tests/develop/developer/output/igaztanaga-gcc-5-1c++14-boost-bin-v2-libs-log-test-attr_function-test-gcc-mngw-5-1c+-dbg-dbg-symbl-off-thrd-mlt.html
>>
>>
> and maybe because of "-Werror=sign-compare" ? or again this is hiding
> something else that was cut off in the report...

The problem is that if we test an unsigned integer against a literal
integer value, then we a warning in the first test but not the second:

   unsigned int value = 1;
   BOOST_REQUIRE(value == 1); // No sign compare warning
   BOOST_REQUIRE_EQUAL(value, 1); // Sign compare warning

The quick fix is for all Boost.Test users to do:

   BOOST_REQUIRE_EQUAL(value, 1U);

but this is inconvenient if you do not know the signedness of the type,
e.g. when you use a size() member function on some container.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk