Subject: [Boost-bugs] [Boost C++ Libraries] #11740: string_ref not working correctly with rvalue of std::string
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-10-19 15:04:29
#11740: string_ref not working correctly with rvalue of std::string
--------------------------+---------------------------
Reporter: steweg@⦠| Owner: no-maintainer
Type: Bugs | Status: new
Milestone: | Component: utility
Version: Boost 1.59.0 | Severity: Problem
Keywords: string_ref |
--------------------------+---------------------------
This is currently allowed:
boost::string_ref something;
something = "temp"; // works ok
something = std::string("temp"); //doesn't work corretly
while it should not be a should only be:
boost::string_ref something;
something = "temp"; // works ok
std::string tempStr("temp");
something = tempStr; // works ok
Current version is pointing to buffer that is no longer part of any
std::string, therefore if you use something like valgrind it will trigger
and error.
Attached is a simple patch that prevent this.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11740> 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:19 UTC