https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83503
Bug ID: 83503 Summary: [8 Regression] bogus -Wattributes for const and pure on function template specialization Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- Starting with version 8.0 (r255469) GCC issues the following spurious warning for the definition of the function template specialization of f<int> even though it's distinct from the primary template. GCC 7 and prior issued only the -Wunused-value warning. I wonder if the underlying problem is the same as in bug 83502. $ cat u.C && gcc -S -Wall u.C template <class T> int __attribute__ ((pure)) f (T) { return 0; } template <> int __attribute__ ((const)) f<int> (int) { return 1; } void fi () { f (0); } u.C:5:40: warning: ignoring attribute ‘const’ because it conflicts with attribute ‘pure’ [-Wattributes] int __attribute__ ((const)) f<int> (int) { return 1; } ^ u.C: In function ‘void fi()’: u.C:7:16: warning: statement has no effect [-Wunused-value] void fi () { f (0); } ~~^~~