Template instatiation bug.

Roy Dragseth royd@math.uit.no
Thu Oct 30 08:30:00 GMT 1997


Hi, I just discovered what I beleive is a bug in egcs-971023. 

Configuration: HP-UX 10.20, gas, native ld.

Error: 
g++ template_test.cc -o template_test.out
/usr/ccs/bin/ld: Unsatisfied symbols:
   operator>>(istream &, C_matrix<double> &)(code)
collect2: ld returned 1 exit status


while compiling this file:
--------------------------------------------------------------------------------
#include <iostream.h>

template<class T>
class C_matrix
{
  protected:
    T* v_;                  

  friend istream& operator>>(istream &s, C_matrix &A);
};


template <class T>
istream& operator>>(istream &s, C_matrix<T> &A)
{
  s >> *A.v_;
  return s;
}


main()
{
  C_matrix<double> A;
  cin >> A;
}


// Local Variables:
// compile-command: "g++ template_test.cc -o template_test.out"
// eval: (c-toggle-auto-hungry-state 1)
// End:
--------------------------------------------------------------------------------

explicit instantiation didn't work either.

Roy.
 



More information about the Gcc-bugs mailing list