This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
bugreport gcc on linux
- To: gcc-bugs at gcc dot gnu dot org
- Subject: bugreport gcc on linux
- From: Jens Litzenburger <litzenburger at ise-pc52 dot bau-verm dot uni-karlsruhe dot de>
- Date: Tue, 20 Jun 2000 23:03:07 +0200
- Cc: egcs-bugs at egcs dot cygnus dot com
- Organization: Universität Karlsruhe
- Reply-To: Jens dot Litzenburger at bau-verm dot uni-karlsruhe dot de
Dear ladies and gentlemen,
while trying to implement a derived version of the container "vector", my gcc
said:
main.cpp:23: Internal compiler error
main.cpp:23: Please send a full bug report to 'egcs-bugs@egcs.cygnus.com'
main.cpp:23: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.
Reading this URL, If ended up with the instructions on
http://gcc.gnu.org/onlinedocs/gcc_8.html#SEC142 which I now try to follow since
I could not find a "gccbug" script on my system.
The nstructions give gcc-bugs@gcc.gnu.org as the email address which is
different from what the compiler says.
Therefore, I decided to send this message to both addresses. Please excuse the
inconvenience which this may have caused.
1.) I could not find the problem in the SEC122 (Known Causes of Trouble with
GCC).
2.) I have no workaround. What I will do is just not using the template
feature and work with a less elegant code.
3.) You don't need to answer, but I hopw my letter will be helpfull.
4.) Version of gcc: gcc version egcs 2.91.66 19990314/Linux (egcs-1.1.2 release)
5.) Computer and operating system
PC hardware, Linux Kernel 2.2.10, SuSE 6.2 distribution
I use kdevelop 1.0 as developping environment.
6.) gcc option line
c++ -DHAVE_CONFIG_H -I. -I. -I.. -O0 -g3 -Wall --save-temps -c main.cpp
6.) source code structure
I put all source code in a tiny main.cpp file to make the bug report more easy.
The error did not depend on whether or not I used .h files or several modules.
7.) the main.cpp file
-------------------begin----------------------
#include <iostream.h>
#include <stdlib.h>
#include <vector.h>
template<typename T = float>
class myvektorbasis
: public vector<T>
{
public:
myvektorbasis();
myvektorbasis(size_type n, const T& value = T() );
~myvektorbasis();
};
template<typename T> myvektorbasis<T>::myvektorbasis(){
}
template<typename T> myvektorbasis<T>::myvektorbasis(size_type n, const T& value ): vector(n,value)
{
}
template<typename T> myvektorbasis<T>::~myvektorbasis(){
}
template class myvektorbasis<double>;
//template class myvektorbasis;
myvektorbasis<int> ab;
int main(int argc, char *argv[])
{
cout << "Hello, World!" << endl;
return EXIT_SUCCESS;
}
---------------------end---------------
8.) main.ii file (is attached to this letter, has been compressed with gzip)
9.) I hve not modified the compiler sources nor given any special arguments
when installing the compiler. The SuSE distribution installs the compiler
automatically form a .rpm file, I have no idea which options it gives to
"configure".
10.) bug description:
The file generates an internal compiler error.
When instantiating the template class due to
(line 30: template class myvektorbasis<double>;),
the compiler reports an error
"main.cpp: In method 'myvektorbasis<double>::myvektorbasis<double>(unsigned
int, const double & = T() )':
main.cpp:30: instantiated from here
mian.cpp:20: Internal compiler error"
(line 20 is the following line: "template<typename T>
myvektorbasis<T>::myvektorbasis(size_type n, const T& value ): vector(n,value)")
The same error is reported when removing the keyword "class" from line 30.
If you comment out line 30 and uncomment line 31 instead ("//template class
myvektorbasis;"), you'll get the following error message:
main.cpp:31: 'struct myvektorbasis' redeclared as different kind of symbol
main.cpp:9: previous declaration pf 'template <class T = float> class
myvektorbasis<T>'
main.cpp:31: explicit instantiation of non-template type 'myvektorbasis'
When removing the class keyword, the message reads something like "ANSI forbids
declaration with no type".
I expected the file to compile without errors. I want the <double> version of
the template class to be instantiated.
Maybe I am wrong. But the compiler error declared itself to be a bug, so I
report it.
----------------------------------------------------------------------
Absender:
Dipl.-Phys. Jens Litzenburger
wissenschaftlicher Angestellter
Abteilung Eisenbahnwesen
Leitung: Universitätsprofessor Dr.-Ing. Eberhard Hohnecker
Institut für Straßen- und Eisenbahnwesen
Universität Karlsruhe
Kaiserstraße 12
76128 Karlsruhe
---------------
Bau 10.30, Zimmer 226
Linien 1,2,4,5,S2,S4,S5 bis "Durlacher Tor"
Telephon: +49 721 608 8994
Telefax: +49 721 608 8998
Rechnerpost: Jens.Litzenburger@bau-verm.uni-karlsruhe.de
Intenetz: http://www.eisenbahn.uni-karlsruhe.de/
----------------------------------------------------------------------
main.ii.gz