From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8208 invoked by alias); 23 Apr 2002 01:16:08 -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 8126 invoked by uid 71); 23 Apr 2002 01:16:03 -0000 Resent-Date: 23 Apr 2002 01:16:03 -0000 Resent-Message-ID: <20020423011603.8125.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, mbritton@gps.caltech.edu Received:(qmail 32254 invoked by uid 61); 23 Apr 2002 01:12:41 -0000 Message-Id:<20020423011241.32253.qmail@sources.redhat.com> Date: Mon, 22 Apr 2002 18:16:00 -0000 From: mbritton@gps.caltech.edu Reply-To: mbritton@gps.caltech.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/6412: ice in template friend member function X-SW-Source: 2002-04/txt/msg01139.txt.bz2 List-Id: >Number: 6412 >Category: c++ >Synopsis: ice in template friend member function >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: ice-on-legal-code >Submitter-Id: net >Arrival-Date: Mon Apr 22 18:16:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Matthew Britton >Release: 3.0.3 >Organization: >Environment: System: Linux eraserhead 2.4.7-10enterprise #1 SMP Thu Sep 6 16:48:20 EDT 2001 i686 unknown >Description: I have a template class myclass for which I have defined a template member function operator+=, which takes as an argument an instantiation of the template class. I wanted to make the function a friend of other instantiations of myclass. For example, I wanted the function myclass & myclass::operator+=(const myclass &) to be a friend of myclass. To accomplish this I tried the following code. template class myclass { protected: T data; public: myclass(){ data = 0; } myclass(const myclass & mc) { data = mc.data; } ~myclass(){}; myclass & operator=(const myclass & mc) { if(this==&mc) return(*this); data = mc.data; return(*this); } template myclass & operator+=(const myclass & mc) { data += mc.data; } template template friend myclass & myclass::operator+=(const myclass & mc); }; int main(int argc, char * argv[]) { myclass fmc; myclass dmc; dmc += fmc; } I got the following error test.C: In function 'int main(int, char**)': test.C:43: Internal compiler error in retrieve_specialization, at cp/pt.c:739 Please submit a full bug report. with preprocessed source if appropriate. See for instructions. >How-To-Repeat: >Fix: I don't know of any workaround >Release-Note: >Audit-Trail: >Unformatted: