Boost logo

Boost :

Subject: Re: [boost] [utility/swap] MSVC 10 test failure, unsigned long to std::bitset conversion invalid?
From: Niels Dekker - address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2010-03-07 07:15:27


On 2010-03-07 12:39, Joseph Gauterin wrote:
> Am I right in thinking that the test would pass if not for a
> bug in MSVC10?

Yes, indeed.

> If so, I'd be more inclined to mark the test as an expected
> failure on the MSVC10 than change the test itself.

Actually I have considered this approach as well, but I changed my mind.
Because it's not the purpose of libs/utility/swap/test/std_bitset.cpp to
test the initialization of an std::bitset. Its purpose is to test
whether boost::swap correctly swaps two different std::bitset objects:

   typedef std::bitset<8> bitset_type;
   const bitset_type initial_value1 = <some value>;
   const bitset_type initial_value2 = <some other value>;

   bitset_type object1 = initial_value1;
   bitset_type object2 = initial_value2;

   boost::swap(object1,object2);

   BOOST_CHECK_EQUAL(object1,initial_value2);
   BOOST_CHECK_EQUAL(object2,initial_value1);

How those initial_value1 and initial_value2 are actually initialized is
irrelevant to the test. However, std_bitset.cpp should test whether
boost::swap does the right thing, on any platform, including Microsoft
Windows + VC 10.

Hope you agree. But please let me know if you still object against the
workaround, which just replaces "1ul" by "1", and "2ul" by "2":

   const bitset_type initial_value1 = 1;
   const bitset_type initial_value2 = 2;

Of course, you can also add your comments to the ticket:
https://svn.boost.org/trac/boost/ticket/3984

Kind regards,

   Niels

-- 
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center

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