From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 993553858C98; Thu, 4 Apr 2024 10:02:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 993553858C98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712224925; bh=v325W8piiv98kCgpVCqzpWkOzSZcZDZsSFbUElqSJVw=; h=From:To:Subject:Date:From; b=Hymu/YI7sS7A3mYcXQTHNlURqn01LtrvRtfW8wqNFcbNJNQysr8/OnzAyYWV8TyIF GP37eCWufE+3Q84XTZ8u5Ss4DmdaBm/+wZmNEW6Jl0A0GuWLSzNdDpsKQWrGRCSSrE 8QlQdjCUo1ZCqDgm0UPkPkMQJvXpJ05KseThgZU4= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114580] New: Bogus warning on if constexpr Date: Thu, 04 Apr 2024 10:02:04 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114580 Bug ID: 114580 Summary: Bogus warning on if constexpr Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- #include template void foo () { if constexpr ((T) std::is_constant_evaluated ()) ; } void bar () { foo (); } emits bogus warning with -std=3Dc++17 -Wall. Once it (incorrectly) warns about warning: =E2=80=98std::is_constant_evaluated=E2=80=99 always evaluates to f= alse in a non-=E2=80=98constexpr=E2=80=99 function [-Wtautological-compare] and once it correctly warns about warning: =E2=80=98std::is_constant_evaluated=E2=80=99 always evaluates to t= rue in =E2=80=98if constexpr=E2=80=99 [-Wtautological-compare] on the same line. In reality, std::is_constant_evaluated () here always evaluates to true, never to false.=