stl_bvector.h: Use UL suffix for unsigned longs.

2002-05-31  Marcus Meissner  <meissner@suse.de>

	* include/bits/stl_bvector.h:  Use UL suffix for unsigned longs.
	* testsuite/23_containers/vector_bool.cc (test02):  New test.

From-SVN: r54128
This commit is contained in:
Marcus Meissner 2002-06-01 00:48:21 +00:00 committed by Phil Edwards
parent 6f9b006de0
commit 6c8ce02fcd
3 changed files with 31 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2002-05-31 Marcus Meissner <meissner@suse.de>
* include/bits/stl_bvector.h: Use UL suffix for unsigned longs.
* testsuite/23_containers/vector_bool.cc (test02): New test.
2002-05-30 Marc Espie <espie@openbsd.org>
* configure.in: Always check for sys/types.h
* configure: Regenerate.

View File

@ -166,7 +166,7 @@ struct _Bit_iterator : public _Bit_iterator_base
_Bit_iterator(_Bit_type * __x, unsigned int __y)
: _Bit_iterator_base(__x, __y) {}
reference operator*() const { return reference(_M_p, 1U << _M_offset); }
reference operator*() const { return reference(_M_p, 1UL << _M_offset); }
iterator& operator++() {
_M_bump_up();
return *this;
@ -223,7 +223,7 @@ struct _Bit_const_iterator : public _Bit_iterator_base
: _Bit_iterator_base(__x._M_p, __x._M_offset) {}
const_reference operator*() const {
return _Bit_reference(_M_p, 1U << _M_offset);
return _Bit_reference(_M_p, 1UL << _M_offset);
}
const_iterator& operator++() {
_M_bump_up();

View File

@ -29,8 +29,32 @@ void test01()
++i;
}
// libstdc++/6886
void test02()
{
typedef std::vector<bool> bvec;
int i, num = 0;
bvec v;
v.resize(66);
for (i = 0 ; i < 66 ; ++i)
v[i] = 0;
v[1] = 1;
v[33] = 1;
v[49] = 1;
v[65] = 1;
for (bvec::iterator j = v.begin() ; j != v.end() ; j++)
if (bool(*j)) ++num;
VERIFY( num == 4 );
}
int main()
{
test01();
test02();
return 0;
}