This is the mail archive of the gcc-bugs@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]

Bug: template function ignored


This program demonstrates a bug in egcs 2.93.06.

% c++ -v
Reading specs from /u/dm/OSF1/lib/gcc-lib/alphaev56-dec-osf4.0c/egcs-2.93.06/specs
gcc version egcs-2.93.06 19990208 (gcc2 ss-980929 experimental)
% c++ -c sba.C
sba.C: In method `void prng::transform(struct sumbuf<5> *)':
sba.C:21: no matching function for call to `sumbufadd (sumbuf<16> *, sumbuf<16> *)'
sba.C:22: no matching function for call to `sumbufadd (sumbuf<16> *, sumbuf<5> *&, bool)'

For some reason, egcs is not seing the sumbufadd function.

Thanks,
David

===

#include <sys/types.h>

template<unsigned int N> struct sumbuf {};

template<size_t N, size_t M> inline bool
sumbufadd (sumbuf<N> *dst, const sumbuf<M> *src, bool carry = false)
{
  return carry;
}

struct prng {
  sumbuf<16> state;
  sumbuf<16> input;

  void transform (sumbuf<5> *);
};

void
prng::transform (sumbuf<5> *output)
{
  sumbufadd (&input, &state);
  sumbufadd (&state, output, true);
}


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