public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "egallager at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview]
Message-ID: <bug-61469-4-ajay3eiaBz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61469-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61469
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #8 from Eric Gallager <egallager at gcc dot gnu.org> ---
(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 ..."
>
> That's not how C++ does it, the correct syntax is:
>
> 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-compilation
[-Wpoison-system-directories]
enum.c:1:6: warning: enumeration types with a fixed underlying type are a Clang
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; }
| ^
next prev parent reply other threads:[~2022-05-17 10:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-11 9:58 [Bug c/61469] New: " nick87720z at gmail dot com
2014-06-11 10:04 ` [Bug c/61469] " redi at gcc dot gnu.org
2014-06-11 10:13 ` nick87720z at gmail dot com
2014-06-11 10:25 ` redi at gcc dot gnu.org
2014-06-11 10:40 ` mpolacek at gcc dot gnu.org
2014-06-11 11:29 ` nick87720z at gmail dot com
2021-12-05 10:20 ` pinskia at gcc dot gnu.org
2022-05-17 10:28 ` egallager at gcc dot gnu.org [this message]
2022-05-17 17:53 ` joseph at codesourcery dot com
2022-10-27 0:57 ` jsm28 at gcc dot gnu.org
2022-10-28 0:38 ` cvs-commit at gcc dot gnu.org
2022-10-28 0:39 ` jsm28 at gcc dot gnu.org
2024-04-30 16:35 ` thomas.mercier.jr at gmail dot com
2024-04-30 16:39 ` pinskia at gcc dot gnu.org
2024-04-30 16:48 ` thomas.mercier.jr at gmail dot com
2024-04-30 16:52 ` pinskia at gcc dot gnu.org
2024-04-30 16:54 ` thomas.mercier.jr at gmail dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-61469-4-ajay3eiaBz@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).