Modify

Ticket #5439 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

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

Attachments

Change History

comment:1 Changed 3 years ago by marshall

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

comment:2 Changed 3 years ago by marshall

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

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

View

Add a comment

Modify Ticket

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


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

 
Note: See TracTickets for help on using tickets.