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 13:13:25 -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 #17 from bangerth at dealii dot org 2008-08-07 13:13 -------
(In reply to comment #16)
> The expression cannot be very complicated because it needs to be a INTEGER_CST.
Sure, but it can be of the form
~SOME_PREPROCESSOR_MACRO | (MACRO2 ^ MACRO3)
What I meant to say is that the value of the expression may not be
obvious to the author of the code.
> On the other hand, I agree that it is best to give users as much information as
> reasonable. I think it is better if you comment in gcc-patches so reviewers can
> see your proposal.
Will do next time, I guess for this time we're stuck here :-)
> I would prefer to not repeat twice %T, though. Also, I think
> users are going to have trouble to understand that the range of the enumeral is
> larger than the number of enumerators it contains. Perhaps we should print the
> range of %T?
>
> "the result of %<static_cast%> is unspecified because %qE is outside the range
> [%d,%d] of type %qT."
That would be an excellent idea as well.
Thanks
Wolfgang
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12242