http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47929
Summary: unclear "prototype for '...' does not match any in class" diagnostic for templates Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@gcc.gnu.org Given the invalid code: struct S { void f(); }; template<typename T> void S::f() { } G++ complains: x.cc:7:6: error: prototype for 'void S::f()' does not match any in class 'S' x.cc:3:10: error: candidate is: void S::f() The error message doesn't indicate that one of the signatures is a template, it might be helpful if it did. (I have just spent about a minute being dumb and confused because the line with "template<typename T>" was scrolled off the top of my editor window and I couldn't see why the signatures didn't match!) If the situation is reversed, so the declaration is a template but the definition is not, the error message makes it obvious: x.cc:7:6: error: prototype for 'void S::f()' does not match any in class 'S' x.cc:4:12: error: candidate is: template<class T> void S::f()