[Boost-bugs] [Boost C++ Libraries] #6370: GCC sequence-point warning in unordered_map::iterator increment operator++

Subject: [Boost-bugs] [Boost C++ Libraries] #6370: GCC sequence-point warning in unordered_map::iterator increment operator++
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-01-09 19:32:12


#6370: GCC sequence-point warning in unordered_map::iterator increment operator++
--------------------------------------+-------------------------------------
 Reporter: john@… | Owner: danieljames
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: unordered
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: |
--------------------------------------+-------------------------------------
 The following code triggers GCC -Wsequence-point warning. It is unclear
 whether GCC has detected a bug in boost::unordered_map, or whether this is
 a false positive.

 {{{
 #!cpp
 #include <boost/unordered_map.hpp>
 void f (){
     boost::unordered_map<int,int>::iterator i;
     ++i;
 }
 }}}

 * The issue appears in boost 1_48 (latest).
 * The issue does not appear in 1_47.
 * The GCC version is 4.6.2 (latest).
 * const_iterator does not trigger the issue.

 The complete output is:

 {{{
 $ g++ -Wall -c issue.cpp
 In file included from
 /usr/include/boost/unordered/detail/equivalent.hpp:14:0,
                  from /usr/include/boost/unordered/unordered_map.hpp:18,
                  from /usr/include/boost/unordered_map.hpp:16,
                  from wtf.cpp:1:
 /usr/include/boost/unordered/detail/table.hpp: In member function
 â€˜boost::unordered::iterator_detail::iterator<NodePointer, Value>&
 boost::unordered::iterator_detail::iterator<NodePointer,
 Value>::operator++() [with NodePointer =
 boost::unordered::detail::ptr_node<std::pair<const int, int> >*, Value =
 std::pair<const int, int>,
 boost::unordered::iterator_detail::iterator<NodePointer, Value> =
 boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const
 int, int> >*, std::pair<const int, int> >]’:
 wtf.cpp:4:7: instantiated from here
 /usr/include/boost/unordered/detail/table.hpp:177:13: warning: operation
 on
 â€˜((boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const
 int, int> >*, std::pair<const int, int>
>*)this)->boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const
 int, int> >*, std::pair<const int, int> >::node_’ may be undefined
 [-Wsequence-point]
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6370>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC