public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/44500] [C++0x] Bogus narrowing conversion error
Date: Fri, 11 Jun 2010 13:33:00 -0000	[thread overview]
Message-ID: <20100611133332.29042.qmail@sourceware.org> (raw)
In-Reply-To: <bug-44500-11646@http.gcc.gnu.org/bugzilla/>



------- Comment #10 from manu at gcc dot gnu dot org  2010-06-11 13:33 -------
(In reply to comment #8)
> 
> In both cases, T+T has type int, 

We know that, but I don't think most C/C++ programmers know about integer
promotion rules. We just disagree here. But since this is mandated by the
standard, you are right.

> so obviously it fits in an int.  It doesn't

For a strict-standard definition of "fits", because it may overflow and a
layman wouldn't say that it "fits" in that case.

> This is mandated by the standard and the diagnostic is IMHO clear. 

I am not arguing against that (although, I think it is unfortunate). I would
prefer a bit longer message:

error: C++0x does not allow narrowing conversion of "(((int)y) + 1)" from "int"
to "char" inside { }

(BTW, I think those braces should be within quotes).

But since I guess I am in the minority here, we'll have to close this as
INVALID. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44500


  parent reply	other threads:[~2010-06-11 13:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-11 10:46 [Bug c++/44500] New: " gpiez at web dot de
2010-06-11 10:57 ` [Bug c++/44500] [C++0x] " manu at gcc dot gnu dot org
2010-06-11 11:34 ` gpiez at web dot de
2010-06-11 11:38 ` redi at gcc dot gnu dot org
2010-06-11 11:43 ` redi at gcc dot gnu dot org
2010-06-11 12:09 ` gpiez at web dot de
2010-06-11 12:51 ` redi at gcc dot gnu dot org
2010-06-11 13:07 ` manu at gcc dot gnu dot org
2010-06-11 13:20 ` redi at gcc dot gnu dot org
2010-06-11 13:27 ` gpiez at web dot de
2010-06-11 13:33 ` manu at gcc dot gnu dot org [this message]
2010-06-11 14:56 ` redi at gcc dot gnu dot org
2010-06-12  8:46 ` gpiez at web dot de
2010-06-12  8:47 ` gpiez at web dot de
2010-06-13 17:14 ` redi at gcc dot gnu dot org
2010-07-09 21:29 ` jason at gcc dot gnu dot org
2010-07-09 21:29 ` jason at gcc dot gnu dot org
2010-07-09 21:30 ` jason at gcc dot gnu dot org
     [not found] <bug-44500-4@http.gcc.gnu.org/bugzilla/>
2011-03-24  9:32 ` jason at gcc dot gnu.org
2011-03-24  9:37 ` jason at gcc dot gnu.org
2011-03-24 12:04 ` gpiez at web dot de

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=20100611133332.29042.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).