From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3922 invoked by alias); 28 Jan 2003 21:46:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3901 invoked by uid 71); 28 Jan 2003 21:46:00 -0000 Resent-Date: 28 Jan 2003 21:46:00 -0000 Resent-Message-ID: <20030128214600.3900.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jrestemeier@currantbun.com Received: (qmail 30236 invoked by uid 48); 28 Jan 2003 21:37:12 -0000 Message-Id: <20030128213712.30235.qmail@sources.redhat.com> Date: Tue, 28 Jan 2003 21:46:00 -0000 From: jrestemeier@currantbun.com Reply-To: jrestemeier@currantbun.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9489: gcc fails to find implicit conversion with template class X-SW-Source: 2003-01/txt/msg01638.txt.bz2 List-Id: >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 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; } }; templateclass bar { public: T ping, pong; bar() {} bar(const foo & f) { ping = f.a; pong = f.b; } bar(int a, int b) { ping = a; pong = b; } operator foo() const { foo f; f.a = ping; f.b = pong; return f; } }; int main (int argc, const char * argv[]) { // foo f; bar 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& + bar&' operator remove the comment in front of "foo f" and it compiles with just a warning about f beeing unused. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: