STL problem compiling MICO-2.2.1 with egcs-2.92.16 (19981019)

Martin von Loewis martin@mira.isdn.cs.tu-berlin.de
Tue Nov 3 15:23:00 GMT 1998


> I don't know if the attached file helps, but one of the guys asked me to
> compile with the -E option vs -c option, and send him the output of the
> .cc file that is failing.

Thanks for this file, it was very helpful. A reduced version of the
problem is

struct X{
  operator long double();
};

template <class _InputIter, class _OutputIter, class _UnaryOperation>
_OutputIter transform(_InputIter __first, _InputIter __last,
                      _OutputIter __result, _UnaryOperation __opr) {
  for ( ; __first != __last; ++__first, ++__result)
    *__result = __opr(*__first);
  return __result;
}

With egcs-2.92.17 19981031, I get, on i486-pc-linux-gnu, the message

s.cc:7: declaration of `operator long double' as non-function
s.cc:7: confused by earlier errors, bailing out

This is because __opr is reserved internally to represent the long
double conversion operator, which gets later confused with the
parameter name. As a work-around, you should replace __opr in your
copy of libstdc++, with, say, __p_opr.

It seems the bug is in the library, which should not use names
reserved by the compiler. There is also a bug in the compiler:
Internally, it gives the type 'X' to the IDENTIFIER_NODE __opr, which
seems wrong (it is late, so it might be me who is wrong).

Hope this helps,
Martin



More information about the Gcc-bugs mailing list