https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80140
Bug ID: 80140 Summary: missing -Wignored-attributes on function arguments Product: gcc Version: 7.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: --- GCC ignores all five of the attributes in the test case below but only diagnoses one of them, on the declaration of f_ref_noreturn. It should diagnose all of them. $ cat t.C && gcc -S -Wall -Wextra -Wpedantic -Wignored-attributes t.C void f_ptr_unused (void * __attribute__((unused))); void f_ptr_unused (void *p) // -Wunused issued regardless of attribute { } int f_ptr_noreturn (void (*)() __attribute__((noreturn))); int f_ptr_noreturn (void (*fp)()) { fp (); // -Wreturn-type regardless of attribute } int f_ref_noreturn (void (&)() __attribute__((noreturn))); // warning (ok) int f_ptr_noreturn (void (&fr)()) { fr (); // -Wreturn-type (expected, warning on declaration) } template <void (*FP)() __attribute__((noreturn))> int ftempl_ptr_noreturn () { FP (); // -Wreturn-type regardless of attribute } void f (); template int ftempl_ptr_noreturn<&f>(); template <void (&FR)() __attribute__((noreturn))> int ftempl_ref_noreturn () { FR (); // -Wreturn-type regardless of attribute } template int ftempl_ref_noreturn<f>(); t.C: In function ‘void f_ptr_unused(void*)’: t.C:3:26: warning: unused parameter ‘p’ [-Wunused-parameter] void f_ptr_unused (void *p) // -Wunused issued regardless of attribute ^ t.C: In function ‘int f_ptr_noreturn(void (*)())’: t.C:12:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ t.C: At global scope: t.C:15:56: warning: ‘noreturn’ attribute ignored [-Wattributes] int f_ref_noreturn (void (&)() __attribute__((noreturn))); // warning (ok) ^ t.C: In function ‘int f_ptr_noreturn(void (&)())’: t.C:20:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ t.C: In function ‘int ftempl_ptr_noreturn()’: t.C:27:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ t.C: In function ‘int ftempl_ref_noreturn()’: t.C:37:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^