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]

Template instatiation bug.


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.
 


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