From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 40CAC382EF09; Thu, 24 Nov 2022 19:34:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40CAC382EF09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669318456; bh=gPGXIPRXWkQYKuCHJdMUcrQeQTTYLO/VHm43vJ0Ja8I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oXz8/dyoHTOlN7C6hTb+EecAhcgLWsJRMCzFcvoE210Sf30kliHixJZs31GmeLjxM d3QgVmkF3OBiqm/bjbPTfUW2NdxOdfO0Uzoxi3nScKFAX4pcUFrylaPj/ljgNgPviQ Q3Zqus69WX9jrvzrIgU5UA2hrEJv179b8ltZexbs= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107861] C++ static_assert() does not honor -fwrapv, leading to compilation error Date: Thu, 24 Nov 2022 19:34:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi 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: Message-ID: In-Reply-To: References: 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=3D107861 --- Comment #5 from Jonathan Wakely --- To expand on that, the standard allows compilers to do anything for undefin= ed behaviour, including making it valid with well-defined semantics. So wrappi= ng for undefined overflow is a conforming extension. But the outcome of overfl= ow in a constant expression is not undefined, so the implementation isn't allo= wed to choose the behaviour. It has to be ill-formed (although maybe that could= be a pedantic warning when -fwrapv is used).=