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: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 02 Nov 2017 00:55:35 +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@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67314
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=61864,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=78736,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=7654
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #5)
> (In reply to Martin Sebor from comment #4)
> > The trouble is that while gcc makes it easy to assign without a warning
> > values to enums that are outside the range of the enumerated type, it makes
> > it difficult to handle such values in case and switch statements without
> > eliciting one of the -Wswitch warnings. In those cases gcc either complains
> > about "case values being not in enumerated type" or it complains about a
> > "switch missing default case" and there doesn't seem to be an easy way to
> > make it happy.
>
> See also Bug 61864 for more on issues with warnings having to do with the
> relationship between enums and switch statements.
Bug 78736 and bug 7654 are both also related.