Opened 12 years ago

Closed 11 years ago

#5439 closed Bugs (fixed)

warning on dynamic bitset

Reported by: lieven.de.cock@… Owned by: jsiek
Milestone: To Be Determined Component: dynamic_bitset
Version: Boost 1.47.0 Severity: Cosmetic
Keywords: Cc:

Description

When code is being compiled with the gcc compiler option "-Wshadow" [warn whenever a local variable shadows another local variable, parameter or global variable or whenever a build-in function is shadowed ...] we get a warning.

dynamic_bitset.hpp

in the method : template <typename Block, typename Allocator> unsigned long dynamic_bitset<Block, Allocator>:: to_ulong() const

at the line (1111) :

  const size_type max_size =
            (std::min)(m_num_bits, static_cast<size_type>(ulong_width));

  const size_type last_block = block_index( max_size - 1 );

The max_size local variable shadows the max_size method.

Solution is trivial , rename the local variable : max_size -> maximum_size

  const size_type maximum_size =
            (std::min)(m_num_bits, static_cast<size_type>(ulong_width));

  const size_type last_block = block_index( maximum_size - 1 );

kind regards, Lieven

Change History (2)

comment:1 by Marshall Clow, 11 years ago

(In [71505]) Applied patch; Refs #5439

comment:2 by Marshall Clow, 11 years ago

Resolution: fixed
Status: newclosed

(In [72331]) Merge fixes to release; Fixes #5439

Note: See TracTickets for help on using tickets.