public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi 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 11:43:00 -0000 [thread overview]
Message-ID: <20100611114250.12203.qmail@sourceware.org> (raw)
In-Reply-To: <bug-44500-11646@http.gcc.gnu.org/bugzilla/>
------- Comment #4 from redi at gcc dot gnu dot org 2010-06-11 11:42 -------
(In reply to comment #2)
> Sorry for the unicode mess. The error> I believe I should not get an error, even if the template parameter type is
> larger than a char, as long as the template parameter value fits in in char, so
>
> template<int C> void f() {
> char y = 42;
> A a = { y+C };
> }
>
> should give no error, as long as C fits in a char. IMHO ;-)
Just to be extra clear: C is a constant and the narrowing is *not* due to C,
consider:
struct A {
char x;
};
template<int C> void f() {
A a = { C };
}
int main() {
f<1>();
}
Here C is an int, but it's a constant and it is provable that no narrowing
takes palce.
The problem in your example is 'y' not 'C' because the value of 'y' is not a
constant.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44500
next prev parent reply other threads:[~2010-06-11 11:43 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 [this message]
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
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=20100611114250.12203.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).