1// { dg-do assemble } 2// spurious 'const' in error. 3// For egcs-2.91.34, the warning message refers to 4// class ostream & operator <<(class ostream &, const class Vector<T> &) 5// Also, the template instantiation does not provide the missing 6// friend function, the non-template function does 7 8#include <cstdio> 9#include <cstdlib> 10#include <iostream> 11 12using namespace std; 13 14template <class T> 15class Vector 16{ 17 friend ostream& operator<< (ostream& out, const Vector<T> & vec); // { dg-warning "non-template" "warn" } 18 // { dg-message "note" "note" { target *-*-* } 17 } 19}; 20 21template <class T> 22ostream& operator<< (ostream& out, const Vector<T> & vec) 23{ 24 abort(); // this should not be called 25} 26 27template class Vector<char>; 28template ostream& operator<< (ostream& out, const Vector<char> &); 29 30ostream& operator<< (ostream& out, const Vector<char>&) 31{ 32 return out; 33} 34 35int main() 36{ 37 Vector<char> vc; 38 cout << vc; 39} 40