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-06 16:17:14
Hi Juergen ! :-)
>>> There's a regression failure of Microsoft Visual C++ 10 on a unit test
>>> Can anyone here reproduce the compile error?
>> Yes, using msvc-10.0 RC (I hope :-))
> So, it seem that using (1) and (2) resolves this issue:
> Index: std_bitset.cpp
> --- std_bitset.cpp (revision 60227)
> +++ std_bitset.cpp (working copy)
> @@ -17,8 +17,8 @@
> int test_main(int, char*)
> typedef std::bitset<8> bitset_type;
> - const bitset_type initial_value1 = 1ul;
> - const bitset_type initial_value2 = 2ul;
> + const bitset_type initial_value1(1);
> + const bitset_type initial_value2(2);
> bitset_type object1 = initial_value1;
> bitset_type object2 = initial_value2;
> Tested with msvc-10.0, msvc-9.0 and gcc-4.4 (mingw)
Thanks for testing on msvc-9.0 and gcc-4.4 as well! That's great.
One more question: would copy-initialization work here as well? As follows:
const bitset_type initial_value1 = 1;
const bitset_type initial_value2 = 2;
I like that syntax better than direct-initialization (using parentheses)
in this case, because I want to be sure that initial_value1 will get the
value 1, and initial_value2 will get the value 2. In case of
direct-initialization, the initialized object may not always get the
same value as the argument. (For example: when doing std::vector<int>
vec(42); vec will not get the value 42.) And in case of std::bitset, I
wanted to use a non-explicit constructor anyway.
If copy-initialization from int to std::bitset works well, I think I'll
commit that as workaround. So Juergen, please let me know, if you can
give it another try, for msvc-10.0, msvc-9.0 and gcc-4.4.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk