public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100700] New: -Wreturn-type has many false positives
@ 2021-05-20 10:33 gonzalo.gadeschi at gmail dot com
  2021-05-20 17:58 ` [Bug c++/100700] " msebor at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gonzalo.gadeschi at gmail dot com @ 2021-05-20 10:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100700

            Bug ID: 100700
           Summary: -Wreturn-type has many false positives
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gonzalo.gadeschi at gmail dot com
  Target Milestone: ---

Example (https://clang.godbolt.org/z/o85KbdG7h):

int f(unsigned i) {
  if (i < unsigned(-1)) return i;
}

enum E { A, B };

int h(E e) {
  switch (e) {
  case A: return 0;
  case B: return 0;
  }
}

compiled with g++ (no -Wall, no -Wextra) warns with:

 warning: control reaches end of non-void function [-Wreturn-type]

for "f" and "h".

Notice that clang, which implements the same warning, does not warn for "h"
(https://clang.godbolt.org/z/Ev9eqsqPf).

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

end of thread, other threads:[~2021-05-23 14:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 10:33 [Bug c++/100700] New: -Wreturn-type has many false positives gonzalo.gadeschi at gmail dot com
2021-05-20 17:58 ` [Bug c++/100700] " msebor at gcc dot gnu.org
2021-05-20 19:09 ` gonzalo.gadeschi at gmail dot com
2021-05-20 20:20 ` redi at gcc dot gnu.org
2021-05-20 21:14 ` gonzalo.gadeschi at gmail dot com
2021-05-21 14:21 ` egallager at gcc dot gnu.org
2021-05-21 16:51 ` harald at gigawatt dot nl
2021-05-23 14:32 ` redi 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).