Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-06-12 06:26:07


>CC -c -O2 -I../../../ -o
sunpro/libboost_regex/cregex.o ../src/cregex.cpp
"../../..//boost/regex/detail/regex_match.hpp", line 1581: Error:
Templates can only declare classes or functions.
"../../..//boost/regex/detail/regex_match.hpp", line 1586: Error:
Use ";" to terminate statements.
<

That makes no sense to me at all. You could try defining
BOOST_RE_NO_PARTIAL_FUNC_SPEC, but that should *not* be required - or at
least I don't seem to need that. You might also try preprossessing the
source, and looking to see if something unexpected is happening around line
1581:

template <class charT, class Allocator, class traits, class Allocator2>
inline bool regex_match(const charT* str,
                        match_results<const charT*, Allocator>& m,
                        const reg_expression<charT, traits, Allocator2>& e,

                        unsigned flags = match_default)
{
   return regex_match(str, str + traits::length(str), m, e, flags);
}
template <class ST, class SA, class Allocator, class charT, class traits,
class Allocator2>
inline bool regex_match(const std::basic_string<charT, ST, SA>& s,
                 match_results<typename std::basic_string<charT, ST,
SA>::const_iterator, Allocator>& m,
                 const reg_expression<charT, traits, Allocator2>& e,
                 unsigned flags = match_default)
{
   return regex_match(s.begin(), s.end(), m, e, flags);
}

there's something wrong with the parsing of the code here - I suspect
what's happening is that the second template declaration is being seen as
contained within the first (or something equally nasty), hence my question
about preprocessing the code first. If you still can't see what's going
on, try compiling a file containing nothing but:

#include <boost/regex.hpp>

If it fails, start commenting out code around the error until you find out
what the probable cause is.

Sorry I can't be more specific, but I haven't seen an error quite like that
before!

BTW, this may be a dumb idea, but have you just tried deleting your
compiler, and doing a fresh install, this seems to be setup related?

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/


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