On Sun, Dec 14, 2008 at 6:13 PM, John Maddock <john@johnmaddock.co.uk> wrote:
Aonghus Lawlor wrote:
Thanks for the suggestion- I tried this line:

const std::locale locale;
const std::messages<char>& msgs = std::use_facet<
std::messages<char> >( locale );

but it makes no difference- the program still crashes only with
gcc-4.4, and not previous versions.

I don't follow: does the above code run OK, but regex still crashes?

no, it doesnt run- it crashes with the same backtrace as before:

(gdb) bt
#0  0x90d90b9e in __kill ()
#1  0x90d90b91 in kill$UNIX2003 ()
#2  0x90e07ec2 in raise ()
#3  0x90e1747f in abort ()
#4  0x0026792c in __gnu_cxx::__verbose_terminate_handler ()
#5  0x00265239 in __cxxabiv1::__terminate ()
#6  0x0026527d in std::terminate ()
#7  0x0026539c in __cxa_throw ()
#8  0x001eeb00 in std::__throw_bad_cast ()
#9  0x00370d25 in std::use_facet<std::messages<char> > ()
#10 0x00127c93 in boost::re_detail::basic_regex_implementation<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::basic_regex_implementation ()
#11 0x001256a6 in boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign ()
#12 0x00001d6a in boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign ()
#13 0x00001d3e in boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign<std::char_traits<char>, std::allocator<char> > ()
#14 0x00001c9f in boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::basic_regex<std::char_traits<char>, std::allocator<char> > ()
#15 0x00001b05 in main ()
 


This is the compile command I am using (on osx):

g++-mp-4.4 -g -o boost_test_regex boost_test_regex.C
-I/opt/local/include/boost -L/opt/local/lib -lboost_regex-mt

and it terminates like this:

$ ./boost_test_regex
terminate called after throwing an instance of 'std::bad_cast'
 what():  std::bad_cast
Abort trap

The gcc-4.4 is from macports, and was working fine with the rest of
my code, until I ran into this problem with boost:

$ g++-mp-4.4 -v
Using built-in specs.
Target: i386-apple-darwin9.5.0
Configured with: ../gcc-4.4-20081128/configure --prefix=/opt/local
--enable-languages=c,c++,objc,obj-c++ --libdir=/opt/local/lib/gcc44
--includedir=/opt/local/include/gcc44 --infodir=/opt/local/share/info
--mandir=/opt/local/share/man --with-local-prefix=/opt/local
--with-system-zlib --disable-nls --program-suffix=-mp-4.4
--with-gxx-include-dir=/opt/local/include/gcc44/c++/
--with-gmp=/opt/local
--with-mpfr=/opt/local
Thread model: posix
gcc version 4.4.0 20081128 (experimental) (GCC)


I'm not really familiar with the usage of locale's and use_facet's ,
so I'm grateful for any other suggestions you might have,

None at present, other than use a released version of gcc rather than the current 4.4 development branch.  Probably your best bet is to report this as a bug to the gcc folks - if you need help in figuring out a test case let me know - but as I don't have access to that platform you'll have to do most of the work!


fair enough- I figured it might have been a bug in boost- but I'll report it to the gcc list anyway,

thanks,

a
 

Cheers, John.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users