public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/12242] g++ should warn about out-of-range int->enum conversions
Date: Thu, 07 Aug 2008 13:14:00 -0000	[thread overview]
Message-ID: <20080807131325.19323.qmail@sourceware.org> (raw)
In-Reply-To: <bug-12242-702@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2008-08-07 13:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-12242-702@http.gcc.gnu.org/bugzilla/>
2006-01-23  1:20 ` gdr at gcc dot gnu dot org
2006-07-08 18:34 ` lopezibanez at gmail dot com
2007-01-21 17:48 ` manu at gcc dot gnu dot org
2008-02-15 11:10 ` manu at gcc dot gnu dot org
2008-02-15 11:15 ` pinskia at gcc dot gnu dot org
2008-02-15 11:33 ` manu at gcc dot gnu dot org
2008-02-15 11:35 ` rguenth at gcc dot gnu dot org
2008-02-15 11:42 ` manu at gcc dot gnu dot org
2008-08-07  5:42 ` bangerth at dealii dot org
2008-08-07  5:43 ` bangerth at dealii dot org
2008-08-07  7:52 ` manu at gcc dot gnu dot org
2008-08-07 13:14 ` bangerth at dealii dot org [this message]
2008-08-09  0:33 ` manu at gcc dot gnu dot org
2008-08-09  0:36 ` manu at gcc dot gnu dot org
2003-09-10 22:28 [Bug c++/12242] New: " gcc-bugzilla at gcc dot gnu dot org
2003-09-10 22:30 ` [Bug c++/12242] " pinskia at gcc dot gnu dot org
2003-09-10 23:10 ` bangerth at dealii dot org
2003-09-10 23:10 ` bangerth at dealii dot org
2003-09-10 23:11 ` bangerth at dealii dot org
2003-12-06  8:22 ` pinskia at gcc dot gnu dot org
2004-08-13 23:45 ` pinskia at gcc dot gnu dot org
2005-02-13 16:22 ` pinskia at gcc dot gnu dot org

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=20080807131325.19323.qmail@sourceware.org \
    --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).