[Boost-bugs] [Boost C++ Libraries] #6405: Assertion exception thrown when using boost::regex_match

Subject: [Boost-bugs] [Boost C++ Libraries] #6405: Assertion exception thrown when using boost::regex_match
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-01-16 17:05:17


#6405: Assertion exception thrown when using boost::regex_match
------------------------------+---------------------------------------------
 Reporter: ses44@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 When attempting to do a regex match using the following code:

 {{{
       bool isValidEmailAddr(const std::string & addr)
       {
         boost::regex
 reg("((^|@)[[:alnum:]!#$%&'*+/=?^_`{|}~-]+(.[[:alnum:]!#$%&'*+/=?^_`{|}~-]+)*){2}$");

         return boost::regex_match(addr, reg);
       }
 }}}

 on a linux box with boost 1.48, gcc version 4.4.6 i get the following
 error:

 /usr/include/boost/smart_ptr/shared_ptr.hpp:418: typename
 boost::detail::shared_ptr_traits<T>::reference
 boost::shared_ptr<T>::operator*() const [with T =
 boost::regex_traits_wrapper<boost::regex_traits<char,
 boost::cpp_regex_traits<char> > >]: Assertion `px != 0' failed.
 Aborted

 Moving my code to my mac, compiling with boost 1.48, gcc 4.7 all seems to
 work fine.

 Additionally, if I try to print the regex on the linux box I get:

 terminate called after throwing an instance of 'std::logic_error'
   what(): basic_string::_S_construct NULL not valid

 I'm going to try to upgrade my linux box to gcc 4.7, but I would like to
 understand what the problem is.

 Thanks much.

 BTW - I noticed a bug report that indicates this may happen in multi-
 threaded environments due to some allocation rules, but this is a very
 simple single threaded test.

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