[Bug c/126715] New: Add new warning for a == 10 ? false : true called -Wredundant-ternary.

kaelfandrew at gmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126715

            Bug ID: 126715
           Summary: Add new warning for a == 10 ? false : true called
                    -Wredundant-ternary.
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaelfandrew at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/eTzvfjc7d

GCC trunk with -O3 -Wall -Wextra does not warn that the C/C++ ternary is
redundant.

```
extern bool src (int a);

bool
src (int a)
{
  return a == 10 ? false : true;
}

```

This shows up in GCC pre r17-2872.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.