public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: jrestemeier@currantbun.com To: gcc-gnats@gcc.gnu.org Subject: c++/9489: gcc fails to find implicit conversion with template class Date: Tue, 28 Jan 2003 21:46:00 -0000 [thread overview] Message-ID: <20030128213712.30235.qmail@sources.redhat.com> (raw) >Number: 9489 >Category: c++ >Synopsis: gcc fails to find implicit conversion with template class >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Jan 28 21:46:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: jrestemeier@currantbun.com >Release: Apple Computer, Inc. GCC version 1151, based on gcc version 3.1 20020420 (prerelease) >Organization: >Environment: MacOS/X >Description: template<class T> class foo { public: T a, b; foo & operator+=(const foo &rhs) { a+=rhs.a; b+=rhs.b; return *this; } friend foo operator+(const foo &lhs, const foo &rhs) { return foo(lhs)+=rhs; } }; template<class T>class bar { public: T ping, pong; bar() {} bar(const foo<T> & f) { ping = f.a; pong = f.b; } bar(int a, int b) { ping = a; pong = b; } operator foo<T>() const { foo<T> f; f.a = ping; f.b = pong; return f; } }; int main (int argc, const char * argv[]) { // foo<int> f; bar<int> a(1,2), b(3,4), c; c=a+b; return 0; } --- This fails with : main.cpp: In function `int main(int, const char**)': main.cpp:37: no match for `bar<int>& + bar<int>&' operator remove the comment in front of "foo<int> f" and it compiles with just a warning about f beeing unused. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2003-01-28 21:46 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-01-28 21:46 jrestemeier [this message] 2003-01-28 23:07 bangerth
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=20030128213712.30235.qmail@sources.redhat.com \ --to=jrestemeier@currantbun.com \ --cc=gcc-gnats@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).