public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96675] New: tautological-compare warning emitted for NTTP bitwise comparison
@ 2020-08-18 10:50 ed at catmur dot uk
  2020-08-18 16:29 ` [Bug c++/96675] [10/11 Regression] " mpolacek at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ed at catmur dot uk @ 2020-08-18 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96675
           Summary: tautological-compare warning emitted for NTTP bitwise
                    comparison
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

template<char c>
constexpr bool f(char d) {
    return 'a' <= c && c <= 'z' ? (d | 0x20) == c :
        'A' <= c && c <= 'Z' ? (d & ~0x20) == c :
        d == c;
}
static_assert(f<'p'>('P'));

In instantiation of 'constexpr bool f(char) [with char c = 'p']':
<source>:7:21:   required from here
<source>:4:44: warning: bitwise comparison always evaluates to false
[-Wtautological-compare]
    4 |         'A' <= c && c <= 'Z' ? (d & ~0x20) == c :
      |                                ~~~~~~~~~~~~^~~~

Per godbolt, this happened somewhere between 10.1.0 and 10.2.0.

Motivation is
https://github.com/capnproto/capnproto/commit/c38629e5a4b8ce9561b81cb23ea5fc39cbd93eb7

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

end of thread, other threads:[~2021-01-05 21:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 10:50 [Bug c++/96675] New: tautological-compare warning emitted for NTTP bitwise comparison ed at catmur dot uk
2020-08-18 16:29 ` [Bug c++/96675] [10/11 Regression] " mpolacek at gcc dot gnu.org
2020-10-12 12:32 ` rguenth at gcc dot gnu.org
2020-10-28 21:30 ` cvs-commit at gcc dot gnu.org
2020-10-28 21:31 ` [Bug c++/96675] [10 " mpolacek at gcc dot gnu.org
2020-12-04  8:42 ` giorgio.audrito at gmail dot com
2020-12-04 10:52 ` giorgio.audrito at gmail dot com
2020-12-04 20:12 ` mpolacek at gcc dot gnu.org
2021-01-05 21:32 ` cvs-commit at gcc dot gnu.org
2021-01-05 21:36 ` mpolacek 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).