public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44500]  New: Bogus narrowing conversion error
@ 2010-06-11 10:46 gpiez at web dot de
  2010-06-11 10:57 ` [Bug c++/44500] [C++0x] " manu at gcc dot gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 20+ messages in thread
From: gpiez at web dot de @ 2010-06-11 10:46 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

Compiling with g++ -std=c++0x, using gcc-4.5.0 :

struct A {
        char x;
};

template<char C> void f() {
        char y = 42;
        A a = { y+C };
}

int main() {
        f<1>();
}

yields an "error: narrowing conversion of ‘(((int)y) + 8)’ from ‘int’
to ‘char’ inside { }".
If I change the template parameter type from "char C" to "int C" the error
message persists, this seems wrong too, but I am not quite shre.

If I leave out the "y", everything is fine.


-- 
           Summary: Bogus narrowing conversion error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gpiez at web dot de
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-03-24 11:46 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-44500-4@http.gcc.gnu.org/bugzilla/>
2011-03-24  9:32 ` [Bug c++/44500] [C++0x] Bogus narrowing conversion error 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
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
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

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