This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: /usr/include/c++/3.2/bits/basic_string.tcc:713: parse error before `(' token


>>>>> "Per" == Per Jessen <per@computer.org> writes:

    Per> All, being new to this list, I don't know if is this the
    Per> right place to ask, but here we go.  I believe there is a
    Per> problem in /usr/include/c++/3.2/bits/basic_string.tcc - see
    Per> excerpt from a listing below.


    Per> Line 713 reads

    Per> __pos = std::min(__size - __n, __pos);

    Per> but I believe this should be

    Per> __pos = min(__size - __n, __pos);

    Per> Am I right in thinking that min is a macro and not part of
    Per> the "std" namespace ? I saw some discussion related to this
    Per> on gcc-bugs, but I didn't see anyone actually calling it a
    Per> bug. Or am I doing something wrong ?

Possibly the latter. It is no macro (in C++), it is a templated
function. It's defined in /usr/include/c++/3.2/bits/stl_algobase.h:

  template<typename _Tp>
    inline const _Tp&
    min(const _Tp& __a, const _Tp& __b)
    {
      // concept requirements
      __glibcpp_function_requires(_LessThanComparableConcept<_Tp>)
      //return __b < __a ? __b : __a;
      if (__b < __a) return __b; return __a;
    }

And it is indeed defined in namespace std.

    >> > > In file included from /usr/include/c++/3.2/string:57, >
    >> from LVCSim_liveCacheSink.cpp:60: >
    >> /usr/include/c++/3.2/bits/basic_string.tcc: In member function
    >> > `_Alloc::size_type std::basic_string<_CharT, _Traits, >
    >> _Alloc>::rfind(const _CharT*, _Alloc::size_type,
    >> _Alloc::size_type) const': >
    >> /usr/include/c++/3.2/bits/basic_string.tcc:713: parse error
    >> before `(' token
    >> >
    >> > The line at 713 is this: > __pos = std::min(__size - __n,
    >> __pos);
    >> 

You are not by any chance trying to compile a Qt/KDE application? Just
have a look at the preprocessed code (use cpp instead of g++) at this
location. How does it look like? And what's the command you've used to
compile this file?

-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux advocate                     - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]