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

Re: eb44


> This should be a WARNING.  Or compile with -w.

OK, here's the revised patch. Somehow, I can't dejagnu get to execute
it when invoking

make check-g++ RUNTESTFLAGS="-v old-deja.exp=eb44.C"

but it does not report a failure

Martin

Index: eb44.C
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C,v
retrieving revision 1.1
diff -c -p -r1.1 eb44.C
*** eb44.C	1998/05/27 23:00:36	1.1
--- eb44.C	1998/06/02 21:51:47
***************
*** 1,4 ****
--- 1,8 ----
  // spurious 'const' in error.
+ // For egcs-2.91.34, the warning message refers to
+ // class ostream & operator <<(class ostream &, const class Vector<T> &)
+ // Also, the template instantiation does not provide the missing
+ // friend function, the non-template function does
  
  #include <stdio.h>
  #include <iostream.h>
***************
*** 6,20 ****
  template <class T>
  class Vector
  {
!   friend ostream& operator<< (ostream& out, const Vector<T> & vec);
  };
  
  template <class T>
  ostream& operator<< (ostream& out,  const Vector<T> & vec)
! {}
  
  template class Vector<char>;
  template ostream& operator<< (ostream& out,  const Vector<char> &);
  
  main()
  {
--- 10,31 ----
  template <class T>
  class Vector
  {
!   friend ostream& operator<< (ostream& out, const Vector<T> & vec); // WARNING - 
  };
  
  template <class T>
  ostream& operator<< (ostream& out,  const Vector<T> & vec)
! {
!   abort();  // this should not be called
! }
  
  template class Vector<char>;
  template ostream& operator<< (ostream& out,  const Vector<char> &);
+ 
+ ostream& operator<< (ostream& out, const Vector<char>&)
+ {
+   return out;
+ }
  
  main()
  {


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