// { dg-do assemble } // spurious 'const' in error. // For egcs-2.91.34, the warning message refers to // class ostream & operator <<(class ostream &, const class Vector &) // Also, the template instantiation does not provide the missing // friend function, the non-template function does #include #include #include using namespace std; template class Vector { friend ostream& operator<< (ostream& out, const Vector & vec); // { dg-warning "non-template" "warn" } // { dg-message "note" "note" { target *-*-* } 17 } }; template ostream& operator<< (ostream& out, const Vector & vec) { abort(); // this should not be called } template class Vector; template ostream& operator<< (ostream& out, const Vector &); ostream& operator<< (ostream& out, const Vector&) { return out; } int main() { Vector vc; cout << vc; }