[Boost-bugs] [Boost C++ Libraries] #6346: boost::regex::begin() and boost::regex::end() always return 0

Subject: [Boost-bugs] [Boost C++ Libraries] #6346: boost::regex::begin() and boost::regex::end() always return 0
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-01-02 18:50:47


#6346: boost::regex::begin() and boost::regex::end() always return 0
------------------------------------+---------------------------------------
 Reporter: nowahn <nowahn@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: |
------------------------------------+---------------------------------------
 Hi,

 '''boost::basic_regex<...>::begin()''' and
 '''boost::basic_regex<...>::end()''' always return '''0''' (zero).
 This is because of the status test in the relevant functions in
 '''boost::re_detail::basic_regex_implementation<...>''' (in the file
 boost/regex/v4/basic_regex.hpp:
 The test is
 {{{
 !this->m_status ? ...
 }}}
 it should be
 {{{
 this->m_status ? ...
 }}}
 (without the '!').
 The status is good if equal to zero, '''!...''' is good if NOT equal to
 zero.
 Note that the '''str()''' function a few lines above have a less confusing
 test:
 {{{
 if(this->m_status == 0)
 }}}

 The fix is trivial: remove the '!' (or use the same test as in str()), but
 I tested it very quickly.

 I join a small source code showing the bug, the output of this program
 (with bug not fixed and fixed), and a patch.

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