GitHub #12: Fix MSVC14 warning C4456: declaration of 'x_parent_right' hides previous local declaration

This commit is contained in:
Ion Gaztañaga
2014-08-01 11:05:56 +02:00
parent f6333c3126
commit a6a65cff8d
2 changed files with 10 additions and 3 deletions

View File

@@ -3761,6 +3761,13 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
[section:release_notes Release Notes] [section:release_notes Release Notes]
[section:release_notes_boost_1_57_00 Boost 1.57 Release]
* Fixed bugs:
* [@https://github.com/boostorg/intrusive/pull/12 GitHub #12: ['Fix MSVC14 warning C4456: declaration of 'x_parent_right' hides previous local declaration]]
[endsect]
[section:release_notes_boost_1_56_00 Boost 1.56 Release] [section:release_notes_boost_1_56_00 Boost 1.56 Release]
* Improved Doxygen generated reference and updated and fixed forward-declaration header. * Improved Doxygen generated reference and updated and fixed forward-declaration header.

View File

@@ -411,7 +411,9 @@ class avltree_algorithms
static void rebalance_after_erasure(const node_ptr & header, node_ptr x, node_ptr x_parent) static void rebalance_after_erasure(const node_ptr & header, node_ptr x, node_ptr x_parent)
{ {
for (node_ptr root = NodeTraits::get_parent(header); x != root; root = NodeTraits::get_parent(header)) { for ( node_ptr root = NodeTraits::get_parent(header)
; x != root
; root = NodeTraits::get_parent(header), x_parent = NodeTraits::get_parent(x)) {
const balance x_parent_balance = NodeTraits::get_balance(x_parent); const balance x_parent_balance = NodeTraits::get_balance(x_parent);
//Don't cache x_is_leftchild or similar because x can be null and //Don't cache x_is_leftchild or similar because x can be null and
//equal to both x_parent_left and x_parent_right //equal to both x_parent_left and x_parent_right
@@ -453,7 +455,6 @@ class avltree_algorithms
} }
else { else {
// x is left child (x_parent_right is the right child) // x is left child (x_parent_right is the right child)
const node_ptr x_parent_right(NodeTraits::get_right(x_parent));
BOOST_INTRUSIVE_INVARIANT_ASSERT(x_parent_right); BOOST_INTRUSIVE_INVARIANT_ASSERT(x_parent_right);
if (NodeTraits::get_balance(x_parent_right) == NodeTraits::negative()) { if (NodeTraits::get_balance(x_parent_right) == NodeTraits::negative()) {
// x_parent_right MUST have then a left child // x_parent_right MUST have then a left child
@@ -473,7 +474,6 @@ class avltree_algorithms
else{ else{
BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached
} }
x_parent = NodeTraits::get_parent(x);
} }
} }