Boost logo

Boost :

From: Lars Gullik Bjønnes (larsbj_at_[hidden])
Date: 2003-10-20 15:01:44


After some current development in gcc boost::regex stopped compiling
for me. I have tried to find out if the error is in boost::regex or in
the gcc c++ standard library.

After what I read from 27.4.3.2 it seems that boost::regex is in error
and that some assuption on operations on types is done, and that the
libstdc++ breaks those assumptions.

Especially the conversion of pos_type to streamsize. as far as I
can read, cannot be assumed.

Anyhow this patch is for boost 1.30.2 and I think it should be
correct, please have a look at it and apply it if you find it correct.

Index: cpp_regex_traits.cpp
===================================================================
RCS file:
/usr/local/lyx/cvsroot/lyx-devel/boost/libs/regex/src/cpp_regex_traits.cpp,v
retrieving revision 1.8
diff -u -p -b -r1.8 cpp_regex_traits.cpp
--- cpp_regex_traits.cpp 7 Aug 2003 12:09:24 -0000 1.8
+++ cpp_regex_traits.cpp 20 Oct 2003 20:01:04 -0000
@@ -161,9 +161,9 @@ parser_buf<charT, traits>::seekpos(pos_t
       return pos_type(off_type(-1));
    std::ptrdiff_t size = this->egptr() - this->eback();
    charT* g = this->eback();
- if(sp <= size)
+ if(off_type(sp) <= size)
    {
- this->setg(g, g + ::std::streamsize(sp), g + size);
+ this->setg(g, g + off_type(sp), g + size);
    }
    return pos_type(off_type(-1));
 }
@@ -876,5 +876,3 @@ std::size_t BOOST_REGEX_CALL cpp_regex_t
 } // namespace boost

 #endif

-- 
	Lgb

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk