https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80495
Bug ID: 80495 Summary: attribute [[noreturn]] is accepted in function pointer declarations Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bruno at clisp dot org Target Milestone: --- g++ does not flag an error for use of attribute [[noreturn]] on a function pointer declaration. C++11 [dcl.attr.noreturn] says "The attribute may be applied to a declarator-id in a function declaration." $ cat noreturn1.cc void func1 (void) { for (;;); } [[ noreturn ]] void func2 (void) { for (;;); } __attribute__ ((__noreturn__)) void func3 (void) { for (;;); } void (*fptr11) (void) = func1; void (*fptr12) (void) = func2; void (*fptr13) (void) = func3; [[ noreturn ]] void (*fptr21) (void) = func1; /* expected: error */ [[ noreturn ]] void (*fptr22) (void) = func2; /* expected: error */ [[ noreturn ]] void (*fptr23) (void) = func3; /* expected: error */ $ g++ --version | head -n 1 g++ (GCC) 6.3.0 $ g++ -std=c++11 -pedantic -c noreturn1.cc