From: "Michael Schuster" Organization: LS f. Elektr. Energieversorgung To: djgpp AT delorie DOT com Date: Thu, 19 Dec 1996 08:26:35 MEZ Subject: C++ crashes with compiler error Message-Id: Hi I'm working with Djgpp v2.01, libgpp 2721. I `ve written a C++ programm which you can see at the end of the Mail (my comments are in German, never thought send it to s.o. else) when compiling I get the errors: am.cc:23: Internal compiler error. am.cc:23: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'. I reportet it to bug-g++ but noone answered and I don't know where to find a newsgroup to read about that. Perhaps s.o. can give me hand, what I can do with such a problem? Is there any mistake in my code causing the error? Is it only the version of the libgpp or whatever? Here the c++ code of am.cc: #include #include #include template class element { private: enum typ { unspezifisch, konstant, funktion, invers } art; // typ: 0 nur deklariert, noch nicht naeher spezifiziert // typ: 1 Konstante // typ: 2 Funktion f(x) // typ: 3 1/f(x) T a_co; T (*a_func) (T xa); public: element(const char) // falls noch unbestimmt, immer mit Konstante initialisieren // Notwendig wenn nur Deklariert wird { art=unspezifisch; a_co=0; a_func=NULL; } element (T co) // Konstruktor aufruf fuer Konstanten { art=konstant; a_co=co; a_func=NULL; } element(T (*func)(T) ) // Konstruktor fuer Funktionen { art=funktion; a_func = func; a_co=0; } element(const element& temp) // Copykonstruktor { a_co=temp.a_co; a_func=temp.a_func; art=temp.art; } int typ() // Fuer die Ueberpruefung des Typen ausserhalb der Klasse { switch (art) { case unspezifisch: return 0; case konstant: return 1; case funktion: return 2; case invers: return 3; } }; T invers_a_func(T x) { return 1/a_func(x); } element& operator =(element& temp) // Zuweisungskonstruktor element = element {if (this !=&temp) { a_co=temp.a_co; a_func=temp.a_func; art=temp.art; } return *this; } element& operator= (T ini) //Zuweisungskonstruktor element = T { art=konstant; a_co=ini; return *this; } element& operator= (T (*ini)(T)) //Zuweisungskonstruktor element = funktion (x) { art=funktion; a_func=ini; return *this; } operator T() //Evaluierung T= element { switch (art) { case unspezifisch: { cerr<<"Nicht initialisiert"; return 0; } case konstant: return a_co; default: { cerr<<"Element ist Funktion und keine Konstante"; return 0; } }; } T operator() (T x) //Evaluierung T= element(x) { switch (art) { case unspezifisch: { cerr<<"Nicht initialisiert"; return 0; } case konstant: return a_co; case funktion: return a_func(x); case invers: return invers_a_func(x); }; } element invert(void) { switch (art) { case unspezifisch: cerr<<" Nicht initialisiertes Element kann nicht invertiert werden"; art= unspezifisch; break; case konstant: a_co=1/a_co; break; case funktion: // Achtung die Ausgangsfunktion darf nicht destruiert werden, sonst Fehler art=invers; break; case invers: // Achtung das Ausgangselement darf nicht destruiert werden, sonst Fehler art=funktion; }; return *this; }; }; template element invers (element temp) { return temp.invert(); }; // Fuer die Ausgabe template ostream& operator<<(ostream& s,element temp) { switch(temp.typ()) { case 0: return s <<"Nicht initialisiert"; default: return s< class vektor { public: dimension di; // nur fuer externe Zwecke bestimmt private: int n; // intern fuer die Vektordimension element *el; void init() { di.x=n; di.y=1; } public: vektor(int ni) // Initialsierung mit vektor (9) = Deklartion w,hrend Laufzeit { n=ni; el=new element[n+1](char(0)); init(); } vektor( const vektor& temp) // Copykonstruktor { el=new element[temp.n+1](char(0)); n=temp.n; for (int z=0;z& operator[](const int i) // Fuer die Indizierung vektor[i] { return el[i]; } vektor& operator=(vektor& temp) { if (this!= &temp) { delete[] el; n=temp.n; el=new element[temp.n+1](char(0)); for (int z=0;z class matrix { public: dimension di; private: int n_; //Zeile int m_; //Spalte vektor *zeile; void init() { di.x=n_; //Zeile di.y=m_; //Spalte } public: matrix (int x,int y) { zeile =new vektor[x+1](y); n_=x; m_=y; init(); } matrix (const matrix &temp) // Copykonstruktor { zeile =new vektor[temp.n_+1](temp.m_); n_=temp.n_; m_=temp.m_; for (int z=0;z& operator[](const int x) { return zeile[x]; } matrix& operator=(matrix& temp) { if (this!= &temp) { delete[] zeile; zeile =new vektor[temp.n_+1](temp.m_); n_=temp.n_; m_=temp.m_; for (int z=0;z dimension dim(const vektor& temp) { return temp.di; } template dimension dim(const matrix& temp) { return temp.di; } ostream& operator<<(ostream& s,dimension temp) { return s <<"\n X-dim:\t"< a1=s; // Initialisierung wie double element a2 =&dff; // Initialisierung mit Funktion element a3=a2; // Initialisiernung mit element element a4=1/a1; element a5=invers(a2); //Umdefinition a2=s; // Umdefinition auf Konstante; a1=&dff; // Umdefinition auf Funktion; //Ausgabe cout<<"\n **** Einzelemente ****"; cout<<"\n Konstante \t" < v(9); //10er vektor vektor t(2); vektor de=v; // Zuweisung per Vektor // Initialisierung der einzelnen Elemente v[0]=s; //zuweisung an element 0; v[1]=v[0]; v[2]=s; //Umdefinition v[0]=&dff; //Ausgabe cout<<"\n\n ***** Vektoren *****"; cout <<"\n v"; cout<<"\n Konstante \t" < m(19,19); m[19][19]=s; m[2][1]=&dff; matrix m2=m; //Ausgabe cout<<"\n\n ***** Matrizen *****"; cout <<"\n m2"; cout<<"\n Konstante \t" <