[Boost-bugs] [Boost C++ Libraries] #10165: Error when adding an edge in an adjacency list

Subject: [Boost-bugs] [Boost C++ Libraries] #10165: Error when adding an edge in an adjacency list
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-07-01 14:31:41


#10165: Error when adding an edge in an adjacency list
----------------------------------+------------------------
 Reporter: ernest.galbrun@… | Owner: jewillco
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: graph
  Version: Boost Release Branch | Severity: Regression
 Keywords: |
----------------------------------+------------------------
 I encountered a regression using the boost graph library, but I am not
 exactly sure what caused the regression since the file concerned has not
 changed for a couple of months.

 Here is a little code snippet showing the bug. I am using Visual Studio
 2013, 64 bits. The bug occurs both in debug and release mode :

 #include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/graph_traits.hpp>
 #include <iostream>


 void main() {
         typedef boost::adjacency_list<boost::vecS, boost::vecS,
 boost::directedS, int, int> Graph;
         Graph g(2);
         auto result = add_edge(0, 1, g);
         boost::graph_traits<Graph>::edge_iterator ei, ei_end;
         boost::tie(ei, ei_end) = boost::edges(g);
         std::cout << "edge target is: " << (*ei).m_target << std::endl;
 }

 The result is an uninitialized value of the target vertex:
 14829735431805717965.

 After investigation of the issue, it seems that the problem lies in
 adjacency_list.hpp, pushing the newly created edge into the container, it
 makes a copy from a rvalue reference. This copy does move the property
 unique_ptr but does not copy the target value of the edge.

 I used the qttqched patch to fix this, it simply consists in copying the
 m_target propoerty of the edge along the m_property.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10165>
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:16 UTC