Boost logo

Boost Users :

Subject: [Boost-users] A problem with using boost::regex
From: Michael Lindner (mplmpl_at_[hidden])
Date: 2011-04-19 16:32:00

I have been a boost users for years, but this is the first time I've come
across a problem with using it. I'm posting this in the hopes that one of
you will say "oh yeah you did 'X' wrong", because I have been beating my
head against the wall with this for some time. Thanks for taking a look.

-- Michael Lindner

I have the following program:

#include "boost/regex.hpp"
#include <string>

main(int argc, char** argv)
    std::string re("[123]abc");
    boost::regex reg(re);
    return 0;

It compiles and runs just fine on my Mac and Linux machines. On Windows,
however, it compiles fine, and runs fine compiled under the "Debug"
configuration. When I change that to "Release" however, it crashes with the
following stack trace:

transform() + 0xd5 bytes C++

+ 0x21 bytes C++

+ 0x64 bytes C++

+ 0x399 bytes C++
int,boost::re_detail::w32_regex_traits_implementation<char> >::do_get() +
0x28f bytes C++
int,boost::re_detail::w32_regex_traits_implementation<char> >::get() + 0x69
bytes C++
     dme.exe!boost::re_detail::create_w32_regex_traits<char>() + 0x1b
bytes C++

> >::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> >() + 0x5d bytes C++

> >::do_assign() + 0x5f bytes C++
> >::assign(const char * p1=0x0012ff4c, const char * p2=0x0012ff54, unsigned
int f=0) Line 380 C++

> >::assign<std::char_traits<char>,std::allocator<char> >(const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
s="[123]abc", unsigned int f=0) Line 418 C++

> >::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> ><std::char_traits<char>,std::allocator<char> >(const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
p="[123]abc", unsigned int f=0) Line 393 C++
     dme.exe!main(int argc=1, char * * argv=0x00345628) Line 9 C++

I am using

boost 1.46.0

Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at