public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6412: ice in template friend member function
@ 2002-12-04 4:06 Volker Reichelt
0 siblings, 0 replies; 3+ messages in thread
From: Volker Reichelt @ 2002-12-04 4:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/6412; it has been noted by GNATS.
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
mbritton@gps.caltech.edu
Cc:
Subject: Re: c++/6412: ice in template friend member function
Date: Wed, 4 Dec 2002 13:54:17 +0100
The code compiles fine with gcc 2.95.x, but fails since 3.0.
Thus, we have a regression.
Regards,
Volker
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6412
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/6412: ice in template friend member function
@ 2002-06-05 8:31 lerdsuwa
0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2002-06-05 8:31 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, mbritton, nobody
Synopsis: ice in template friend member function
State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Wed Jun 5 08:31:15 2002
State-Changed-Why:
Confirmed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6412
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/6412: ice in template friend member function
@ 2002-04-22 18:16 mbritton
0 siblings, 0 replies; 3+ messages in thread
From: mbritton @ 2002-04-22 18:16 UTC (permalink / raw)
To: gcc-gnats
>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 <float> & myclass<float>::operator+=(const myclass<double> &)
to be a friend of myclass<double>.
To accomplish this I tried the following code.
template <class T>
class myclass {
protected:
T data;
public:
myclass(){
data = 0;
}
myclass(const myclass<T> & mc) {
data = mc.data;
}
~myclass(){};
myclass & operator=(const myclass<T> & mc) {
if(this==&mc) return(*this);
data = mc.data;
return(*this);
}
template<class U>
myclass<T> & operator+=(const myclass<U> & mc) {
data += mc.data;
}
template<class U>
template<class V>
friend myclass<U> & myclass<U>::operator+=(const myclass<V> & mc);
};
int main(int argc, char * argv[]) {
myclass<float> fmc;
myclass<double> 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 <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>How-To-Repeat:
>Fix:
I don't know of any workaround
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-12-04 12:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-04 4:06 c++/6412: ice in template friend member function Volker Reichelt
-- strict thread matches above, loose matches on Subject: below --
2002-06-05 8:31 lerdsuwa
2002-04-22 18:16 mbritton
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).