From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3A2993857C4D; Tue, 18 Aug 2020 10:50:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A2993857C4D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597747840; bh=yB8UMu2W9ppWaFEvD5djJ+YMpDi3vv+09szAq1KbCe8=; h=From:To:Subject:Date:From; b=M3sslP1N0lHs1IzBWdaeQZ1ATLk13yMQ6IQPuDPe0C1xH7AT3sfXhJjqxQ9bNZBB/ /cc8v7iIQUFiDbCyM51xm/gqywgOGs6/SQgZ8jJgOa4gM0eaesXVXaQEsFCivM/nFv bZf3js44+FsFt7DKFdyTXmhushtrvvDAovJjPQ6E= From: "ed at catmur dot uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96675] New: tautological-compare warning emitted for NTTP bitwise comparison Date: Tue, 18 Aug 2020 10:50:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ed at catmur dot uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 10:50:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96675 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 constexpr bool f(char d) { return 'a' <=3D c && c <=3D 'z' ? (d | 0x20) =3D=3D c : 'A' <=3D c && c <=3D 'Z' ? (d & ~0x20) =3D=3D c : d =3D=3D c; } static_assert(f<'p'>('P')); In instantiation of 'constexpr bool f(char) [with char c =3D 'p']': :7:21: required from here :4:44: warning: bitwise comparison always evaluates to false [-Wtautological-compare] 4 | 'A' <=3D c && c <=3D 'Z' ? (d & ~0x20) =3D=3D c : | ~~~~~~~~~~~~^~~~ Per godbolt, this happened somewhere between 10.1.0 and 10.2.0. Motivation is https://github.com/capnproto/capnproto/commit/c38629e5a4b8ce9561b81cb23ea5f= c39cbd93eb7=