Ticket #5439 (closed Bugs: fixed)

Opened 5 years ago

Last modified 4 years ago

warning on dynamic bitset

Reported by:… Owned by: jsiek
Milestone: To Be Determined Component: dynamic_bitset
Version: Boost 1.47.0 Severity: Cosmetic
Keywords: Cc:


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.


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

comment:1 Changed 5 years ago by marshall

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

comment:2 Changed 4 years ago by marshall

  • Status changed from new to closed
  • Resolution set to fixed

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


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.