template instantiation bug?

Corey Kosak kosak@cs.cmu.edu
Thu Oct 15 12:24:00 GMT 1998


(egcs-1.1b and gcc-2.8.1 like this code just fine)

% cat b2.cc && g++ -v && g++ b2.cc
template<class T>
struct moo_t {
  struct cow_t {};
};

template<class T>
void foo(const moo_t<T>::cow_t *)
{
}

template<class T>
void foo(const moo_t<T> *)
{
  moo_t<T>::cow_t *p=0;
#if WORKAROUND
  foo<T>(p);
#else
  foo(p);
#endif
}

int main()
{
  moo_t<int> x;
  foo(&x);
}
Reading specs from /afs/cs.cmu.edu/project/cmcl-kosak/various-gcc/egcs-19980921b/i386_linux2/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.92.11/specs
gcc version egcs-2.92.11 19980921 (gcc2 ss-980609 experimental)
b2.cc: In function `void foo<int>(const struct moo_t<int> *)':
b2.cc:25:   instantiated from here
b2.cc:18: no matching function for call to `foo (moo_t<int>::cow_t *&)'
% g++ -DWORKAROUND b2.cc
% 



More information about the Gcc-bugs mailing list