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>

int
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:

     msvcr90.dll!7858cc9d()    
     msvcr90.dll!7858ccb5()    
     dme.exe!boost::re_detail::w32_
transform()  + 0xd5 bytes    C++
     dme.exe!boost::re_detail::w32_regex_traits_implementation<char>::transform()  + 0x21 bytes    C++
     dme.exe!boost::re_detail::find_sort_syntax<boost::re_detail::w32_regex_traits_implementation<char>,char>()  + 0x64 bytes    C++
     dme.exe!boost::re_detail::w32_regex_traits_implementation<char>::w32_regex_traits_implementation<char>()  + 0x399 bytes    C++
     dme.exe!boost::object_cache<unsigned int,boost::re_detail::w32_regex_traits_implementation<char> >::do_get()  + 0x28f bytes    C++
     dme.exe!boost::object_cache<unsigned 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++
     dme.exe!boost::re_detail::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >()  + 0x5d bytes    C++
     dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::do_assign()  + 0x5f bytes    C++
>    dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::assign(const char * p1=0x0012ff4c, const char * p2=0x0012ff54, unsigned int f=0)  Line 380    C++
     dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::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++
     dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::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