The warning below is unhelpful in generic code and silencing it by removing the top-level cv qualifiers is unnecessarily tedious.
$ cat t.cpp && g++ t.cpp -W template <class T> T foo () { return T (); } int main () { foo<const int>(); } t.cpp: In function 'int main()': t.cpp:2: warning: type qualifiers ignored on function return type -- Summary: useless warning: type qualifiers ignored on function return type in template code Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sebor at roguewave dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36656