This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error
- To: egcs-bugs at cygnus dot com
- Subject: Internal compiler error
- From: Christophe Boyanique <boyan at imac dot u-paris2 dot fr>
- Date: Fri, 20 Nov 1998 16:55:18 +0100 (CET)
Hi,
I've just found this *funny* error message during my C++ lesson:
~/prog/auzende/c++/tp4$ g++ tmplte2.cc
tmplte2.cc:25: Internal compiler error.
tmplte2.cc:25: Please submit a full bug report to `egcs-bugs@cygnus.com'.
Here is the source code included.
Of course the correct syntax is perfectly working :)
template<class T> T & vecteur<T>::operator[](int n)
The version is:
~/prog/auzende/c++/tp4$ g++ --version
egcs-2.90.27 980315 (egcs-1.0.2 release)
~/prog/auzende/c++/tp4$ uname -a
Linux 2.0.35 #1 Wed Oct 14 21:28:31 CEST 1998 i686 unknown (RedHat 5.1)
Regards, Christophe Boyanique.
#include <iostream.h>
template <class T> class vecteur
{
int nbelem;
T *adr;
public:
vecteur(int);
~vecteur();
T & operator [] (int);
};
template<class T> vecteur<T>::vecteur(int nb)
{
adr = new T[nb+1];
nbelem = nb;
}
template<class T> vecteur<T>::~vecteur()
{
delete adr;
}
template<class T> T & vecteur<T>::operator[](int n)
{
return adr[n];
}
main()
{
vecteur <int> v(4);
v[1] = 4;
v[2] = 3;
v[3] = 2;
v[4] = 1;
for (int i=1; i<=4; i++)
cout << v[i] << " ";
}