public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "apatterno at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/42466] New: Multiple instantiations of template constructor fail Date: Tue, 22 Dec 2009 18:05:00 -0000 [thread overview] Message-ID: <bug-42466-18595@http.gcc.gnu.org/bugzilla/> (raw) The test code: template<class IntT, IntT X> struct A { IntT val_; A() : val_(X) {} A(IntT arg) : val_(arg) {} template<IntT X2> A(const A<IntT, X2>& other) : val_(other.val_) {} }; int main(int argc, char** argv) { A<int, 42> a; A<int, 100> b = a; A<unsigned, 42u> c; A<unsigned, 100u> d = c; A<long, 42l> e; A<long, 100l> f = e; } fails to compile on gcc 4.3.2: case.cpp: In function 'int main(int, char**)': case.cpp:19: error: conversion from 'A<unsigned int, 42u>' to non-scalar type 'A<unsigned int, 100u>' requested case.cpp:22: error: conversion from 'A<long int, 42l>' to non-scalar type 'A<long int, 100l>' requested The first conversion is OK, but the other two conversions are being flagged as errors. Even if I were to put the conversions in a different order, the same results... first one is OK, other two fail. -- Summary: Multiple instantiations of template constructor fail Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: apatterno at gmail dot com GCC build triplet: i686-pc-cygwin GCC host triplet: i686-pc-cygwin GCC target triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42466
next reply other threads:[~2009-12-22 18:05 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-12-22 18:05 apatterno at gmail dot com [this message] 2009-12-22 18:22 ` [Bug c++/42466] " pinskia at gcc dot gnu dot org 2009-12-22 18:29 ` paolo dot carlini at oracle dot com 2009-12-22 19:21 ` jason at gcc dot gnu dot org 2009-12-22 23:17 ` jason at gcc dot gnu dot org 2009-12-31 15:48 ` rguenth 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=bug-42466-18595@http.gcc.gnu.org/bugzilla/ \ --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: linkBe 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).