Possible error in g++ 970907

System Source src@stat.auckland.ac.nz
Mon Sep 8 17:06:00 GMT 1997


While compiling octave 2.0.9 I have hit the following problem.  This
compiles fine with gcc-2.7.2.3.f.2.

/usr/local/pkg/egcs/include/g++/function.h: In function `double * negate(const double *, int)':
/usr/local/pkg/egcs/include/g++/function.h:96: previous non-function declaration `template <class T> struct negate<T>'
In file included from CColVector.cc:37:
mx-inlines.cc:188: conflicts with function declaration `double * negate(const double *, int)'
/usr/local/pkg/egcs/include/g++/function.h: In function `class complex<double> * negate(const class complex<double> *, int)':
/usr/local/pkg/egcs/include/g++/function.h:96: previous non-function declaration `template <class T> struct negate<T>'
mx-inlines.cc:411: conflicts with function declaration `class complex<double> * negate(const class complex<double> *, int)'


-- feature.h --

template <class T>
struct negate : public unary_function<T, T> {
    T operator()(const T& x) const { return -x; }
};


-- mx-inlines.cc --

static inline double *
negate (const double *d, int len)
{
  double *result = 0;
  if (len > 0)
    {
      result = new double [len];
      for (int i = 0; i < len; i++)
	result[i] = -d[i];
    }
  return result;
}




More information about the Gcc mailing list