On Sun, Dec 14, 2008 at 9:37 AM, John Maddock <john@johnmaddock.co.uk> wrote:
Aonghus Lawlor wrote:
Hi,

I am using boost 1.37 on osx from macports and I have a problem
using the regex library with gcc 4.4, although it seems to work
perfectly with gcc 4.3 and 4.2.

The problem is with creating a boost::regex object- simple program
below:

Looking at the backtrace the std::messages facet seems to be failing, can you try something like:

std::locale l;
std::use_facet<std::messages<char> >(l);

and see if that also crashes?

Thanks, John.


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.

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,

thanks,

a