The following: ************** template <typename T> struct Message { friend ostream & operator << (ostream & out, const Message & self) { cout << __PRETTY_FUNCTION__ << endl;
return out; } }; typedef Message<int> IntMsg; inline ostream & operator << (ostream & out, const IntMsg & self) { cout << __PRETTY_FUNCTION__ << endl; return out; } int main() { IntMsg m; cout << m << endl; } Produces: ********* templateoverload.cpp: In function `std::ostream& operator<<(std::ostream&, const IntMsg&)': templateoverload.cpp:33: instantiated from here templateoverload.cpp:0: internal compiler error: in change_decl_assembler_name, at cgraph.c:541 Resolved with out-of-class definition: ************************************** template <typename T> inline ostream & operator << (ostream & out, const Message<T> & self) { cout << __PRETTY_FUNCTION__ << endl; return out; } -- Summary: ICE on overload of friend function definition inside a class Product: gcc Version: 3.4.5 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: philippe at fornux dot com GCC build triplet: gcc version 3.4.5 (mingw special) GCC host triplet: Windows XP GCC target triplet: Mingw http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35641