From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B84983885520; Thu, 24 Nov 2022 20:56:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B84983885520 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669323376; bh=IIzK2nxAYQWa4rIcdOmjKsOl4PKHvXZhwJCGxjpi7qo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iyJwmQu5a+6ZGSvbmWGj67xnKgM/S5epCscR8P4A0hEGSGo2ACyn917R/NBGl6MLb u3O6nGbciwvg40LLxF+v1Y8xIOSMaQQDivFeb4gpztyddgAbEdwJJpx2/FNfyh79iG FY9FgkhMRiO04eoVwoDEM9cCS3NKeLBB9Ru6EarA= 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 20:56:14 +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 #7 from Jonathan Wakely --- (In reply to Markus F.X.J. Oberhumer from comment #6) > Please note that I'm explicitly using "int_max" and not "INT_MAX", It's a constexpr variable with the same value, so that makes no difference whatsoever. > and I'd > appreciate if you could give me a link where the standard says this is > "ill-formed". Thanks! The condition is a static assert must be a constant-expression (C++20 9.1 [dcl.pre] paragraph 6). int_max+1 is not a core constant (C++20 7.7 [expr.const] paragraph 5, bullet 5.7), so is not usable as the condition in a static_assert, so the program = is ill-formed.=