ICE on declaring a template function instantiation a friend that shares the name with a member
Marco Franzen
marcof@thyron.com
Thu Oct 5 09:50:00 GMT 2000
Either of
gcc version 2.97 20001002 (experimental)
gcc version 2.96 20000814 (experimental)
produces an ICE when given the following input.
I believe the code is legal C++, even if 2.95.2 (release) rejects it too
(apparently on the same grounds, but without an ICE).
===========================================================
template <typename T>
class MyIter;
template <typename T>
int
operator- (MyIter<T> const&,
MyIter<T> const&);
template <typename T>
class MyIter {
MyIter operator- (int) const;
friend int operator-<> (MyIter const&, MyIter const&);
};
MyIter <char> x;
===========================================================
GNU C++ version 2.97 20001002 (experimental) (i386-pc-linux-gnu)
compiled by GNU C version 2.97 20001002 (experimental).
/tmp/@22981.1: In instantiation of `MyIter':
/tmp/@22981.1:15: instantiated from here
/tmp/@22981.1:12: invalid use of undefined type `class MyIter'
/tmp/@22981.1:10: forward declaration of `class MyIter'
/tmp/@22981.1:12: Internal compiler error in , at ../gcc/cp/pt.c:5628
Please submit a full bug report.
See for instructions.
-----------------------------------------------------------------
This email is confidential and intended solely for the use of the
individual to whom it is addressed.
Any views or opinions presented are solely those of the author
and do not necessarily represent those of Thyron Limited.
If you are not the intended recipient then please be advised
that you have received this email in error and that any use,
dissemination, forwarding, printing or copying of this email
is strictly prohibited.
If you have received this email in error, please notify the
Thyron IT Administrator on +44 (0)1923 236 050 or
send an email to mail-admin@thyron.com.
Thank You
More information about the Gcc-bugs
mailing list