This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12242] g++ should warn about out-of-range int->enum conversions
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Aug 2008 05:41:43 -0000
- Subject: [Bug c++/12242] g++ should warn about out-of-range int->enum conversions
- References: <bug-12242-702@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #15 from bangerth at dealii dot org 2008-08-07 05:41 -------
Hi Manu,
just saw your patch for PR 12242 and have a comment: I believe the warning
message would be much better if it said *why* the result is unspecified (if the
expression being cast is a bit more complicated then it may not be immediately
clear to the casual observer that the reason is that the value is out of range;
one could also think that for whatever reason conversions between enums are
unspecified -- which of course isn't the true reason).
So I think a better wording would be
+ warning (OPT_Wconversion,
+ "the result of %<static_cast<%T>(%E)%> is unspecified because
the "
+ "value is out of range for type %T",
+ type, expr, type);
Best
Wolfgang
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12242