This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/67314] No warning on assigning an out-of-range integer to an enum
- From: "chengniansun at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 21 Aug 2015 23:54:29 +0000
- Subject: [Bug c/67314] No warning on assigning an out-of-range integer to an enum
- Auto-submitted: auto-generated
- References: <bug-67314-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67314
--- Comment #2 from Chengnian Sun <chengniansun at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> This warning is only useful for c++. C defines the full range of the
> underlying type of the enum for the enum while c++ has different rules.
>
> Also I think this warning would be too noisy for c code and clang is wrong
> to implement it for c.
Thanks for your reply. So in C, if I understand correctly, the enum construct
is mainly to define a set of integer constants. It is not like the enumerations
in other languages, such as Java, to define a set of categorical values.