Modify

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#6346 closed Bugs (fixed)

boost::regex::begin() and boost::regex::end() always return 0

Reported by: nowahn <nowahn@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

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.

Attachments (3)

watchbeginendbug.cpp (445 bytes) - added by nowahn <nowahn@…> 6 years ago.
Source code showing the bug.
output (249 bytes) - added by nowahn <nowahn@…> 6 years ago.
Output of the test program.
fixbeginend.patch (659 bytes) - added by nowahn <nowahn@…> 6 years ago.
Patch fixing the bug.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by nowahn <nowahn@…>

Attachment: watchbeginendbug.cpp added

Source code showing the bug.

Changed 6 years ago by nowahn <nowahn@…>

Attachment: output added

Output of the test program.

Changed 6 years ago by nowahn <nowahn@…>

Attachment: fixbeginend.patch added

Patch fixing the bug.

comment:1 Changed 5 years ago by John Maddock

Resolution: fixed
Status: newclosed

(In [79340]) Fix begin() and end() members and add tests. Fixes #6346.

comment:2 Changed 5 years ago by John Maddock

(In [79556]) Merge collected bug fixes from Trunk: Refs #589. Refs #7032. Refs #7084. Refs #6346.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.