https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104494
Bug ID: 104494 Summary: -Wsuggest-attribute=noreturn catch 22 Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: f.heckenb...@fh-soft.de Target Milestone: --- % cat test3.cpp void f () { [] { throw 42; } (); } % g++ -Wsuggest-attribute=noreturn -O3 test3.cpp -c test3.cpp: In function 'void f()': test3.cpp:1:6: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn] % cat test3.cpp [[noreturn]] void f () { [] { throw 42; } (); } % g++ -Wsuggest-attribute=noreturn -O3 test3.cpp -c test3.cpp: In function 'void f()': test3.cpp:4:1: warning: 'noreturn' function does return clang also gives the latter warning (it doesn't seem to have the -Wsuggest-attribute=noreturn flag), so maybe something in the standard does make f unsuitable for [[noreturn]]. But then -Wsuggest-attribute=noreturn should not suggest so.