The following code snippet produces an incorrect error message (since gcc 3.0):
========================================== template<typename T> struct A {}; template<typename U> void foo(A<U>); template<typename T> A<T> bar() { x; } template A<int> bar<int>(); ========================================== The error message reads: bug.cc: In function 'A<U> bar()': bug.cc:5: error: 'x' was not declared in this scope The "U" in 'A<U> bar()' is wrong here. This is related to PR23293. -- Summary: Misleading names for template parameters in diagnostics Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org BugsThisDependsOn: 23293 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24711