From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B80DA3858D38; Tue, 6 Feb 2024 18:32:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B80DA3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707244368; bh=fT2SvJJvdEcvFKizTeZbdSdpveyrU1L3O1eV+gFxkgE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RagB9bNhHN7/p3grtxvMrEIanANQIzSmiC8MywP41A/6mZGEpVXIcvFVQKI8DfT5p 3LA4rX1bGMRLlnz9wPwWC6LQ58nTBqUEu4hKPH/XFRHuDxzz9SCrDiYGNrAcB/j/an 7ZMFYFjrfwbrQzSvUQUJPeJXQvm3v+ziBfS2wKF0= From: "carlosgalvezp at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/31331] Wenum-constexpr-conversion should be fixed, soon treated as a hard error Date: Tue, 06 Feb 2024 18:32:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: carlosgalvezp at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot 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://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31331 --- Comment #23 from Carlos Galvez --- Ah, I see. I would argue that behavior on trunk is incorrect, though. A C-s= tyle enum with only positive values has an underlying type which is unsigned, on this particular compiler. The platform-agnostic way to determine whether an enum is signed or not is to use std::is_signed>.= =20 Thus a trait called "IsEnumUnsigned" should correctly return "true" on this situation, which is why the code compiles in the example with STEP_OVER_BREAKPOINT.=20 An orthogonal problem is integer promotion, which is what I believe to be t= he root of the problem. Instead of letting the enum silently be promoted into = an integer, it would be preferable to perform an explicit cast to an integer suitable for the arithmetic operation at hand. --=20 You are receiving this mail because: You are on the CC list for the bug.=