OSDN Git Service

04ff13d698ffb28528fa232b1b8287df4505f90b
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb44.C
1 // spurious 'const' in error.
2 // For egcs-2.91.34, the warning message refers to
3 // class ostream & operator <<(class ostream &, const class Vector<T> &)
4 // Also, the template instantiation does not provide the missing
5 // friend function, the non-template function does
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <iostream.h>
10
11 template <class T>
12 class Vector
13 {
14   friend ostream& operator<< (ostream& out, const Vector<T> & vec); // WARNING - 
15 };
16
17 template <class T>
18 ostream& operator<< (ostream& out,  const Vector<T> & vec)
19 {
20   abort();  // this should not be called
21 }
22
23 template class Vector<char>;
24 template ostream& operator<< (ostream& out,  const Vector<char> &);
25
26 ostream& operator<< (ostream& out, const Vector<char>&)
27 {
28   return out;
29 }
30
31 int main()
32 {
33   Vector<char> vc;
34   cout << vc;
35 }