https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84158
Bug ID: 84158 Summary: missing -Wreturn-type due to incorrect handling of attributes for template specializations 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: --- This is a another test case (in addition to pr83503) that illustrates that the C++ front end doesn't handle correctly attributes primary templates and template specializations (as pointed out in bug 83871). In the following test case, the problem manifests itself by a missing -Wreturn-type warning when calling an explicit specialization of a function template (with no noreturn) whose primary template is declared attribute noreturn. $ cat t.C && gcc -S -Wall -Wextra t.C template <class T> T __attribute__ ((noreturn)) f (T); template <> int f (int); int g (int i) { f (i); // missing -Wreturn-type }