https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83502
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Here's another test case with the same root cause (r190664): $ cat u.C && gcc -S -Wall u.C template <class T> int __attribute__ ((warn_unused_result)) f (T) { return 0; } template <> int f<int> (int) { return 1; } void fi () { f (0); } u.C: In function ‘void fi()’: u.C:7:16: warning: ignoring return value of ‘int f(T) [with T = int]’, declared with attribute warn_unused_result [-Wunused-result] void fi () { f (0); } ~~^~~