From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 904993858C51; Tue, 17 May 2022 10:28:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 904993858C51 From: "egallager at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/61469] language feature: Support for enum underlying type Date: Tue, 17 May 2022 10:28:43 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: egallager at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc 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 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, 17 May 2022 10:28:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61469 Eric Gallager changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |egallager at gcc dot gnu.o= rg --- Comment #8 from Eric Gallager --- (In reply to Jonathan Wakely from comment #1) > (In reply to nick87720z from comment #0) > > Unlike C++, where type is specified as "enum class type ..." >=20 > That's not how C++ does it, the correct syntax is: >=20 > enum foo_type : int { foo, bar, baz }; clang supports this as an extension in C: $ clang -Weverything enum.c warning: include location '/usr/local/include' is unsafe for cross-compilat= ion [-Wpoison-system-directories] enum.c:1:6: warning: enumeration types with a fixed underlying type are a C= lang extension [-Wfixed-enum-extension] enum : int { a }; int main(void) { return 0; } ^~~~~ 2 warnings generated. vs. with gcc: $ /usr/local/bin/gcc enum.c enum.c:1:6: error: expected '{' before ':' token 1 | enum : int { a }; int main(void) { return 0; } | ^=