public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104494] New: -Wsuggest-attribute=noreturn catch 22
@ 2022-02-10 21:59 f.heckenbach@fh-soft.de
  2022-02-11  9:16 ` [Bug c++/104494] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: f.heckenbach@fh-soft.de @ 2022-02-10 21:59 UTC (permalink / raw)
  To: gcc-bugs

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.heckenbach@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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-11  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 21:59 [Bug c++/104494] New: -Wsuggest-attribute=noreturn catch 22 f.heckenbach@fh-soft.de
2022-02-11  9:16 ` [Bug c++/104494] " rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).