syntax error causes crash
D Maley
d.maley@airforce1.stmarys-belfast.ac.uk
Sat Nov 7 04:16:00 GMT 1998
std::set<T> seems to cause many more problems than, say std::vector<T>.
Here's one I've been able to isolate.
I'm on a P200 using Solaris 2.6 and egcs 1.1b
/////////////////////////////////////////////////////////////
//
// test.cpp
//
/////////////////////////////////////////////////////////////
#include <vector.h>
#include <set.h>
template <class T1, class T2> class Manager;
template <class T1, class T2> class Manager<set<T> > {
};
template <class T1, class T2> class Manager<vector<T> > {
};
gives an unexpected:
gcc -DXTFUNCPROTO -DSUN -w -falt-external-templates -I/usr/openwin/include
-I/usr/dt/share/include -I. -c -o test.o test.cpp 2>>err
*** Error code 1
make: Fatal error: Command failed for target `test.o'
test.cpp:12: Internal compiler error.
test.cpp:12: Please submit a full bug report to `egcs-bugs@cygnus.com'.
whereas (swapping lines 12 & 14)
/////////////////////////////////////////////////////////////
//
// test.cpp
//
/////////////////////////////////////////////////////////////
#include <vector.h>
#include <set.h>
template <class T1, class T2> class Manager;
template <class T1, class T2> class Manager<set<T> > {
};
template <class T1, class T2> class Manager<vector<T> > {
};
gives
gcc -DXTFUNCPROTO -DSUN -w -falt-external-templates -I/usr/openwin/include
-I/usr/dt/share/include -I. -c -o test.o test.cpp 2>>err
*** Error code 1
make: Fatal error: Command failed for target `test.o'
test.cpp:12: type/value mismatch at argument 1 in template parameter list
for `template <class T, class Alloc = class alloc> vector<T,Alloc>'
test.cpp:12: expected a type, got `T'
test.cpp:12: incorrect number of parameters (1, should be 2)
test.cpp:10: in template expansion for decl `template <class T1, class T2>
Manager<T1,T2>'
test.cpp:12: template class without a name
test.cpp:14: confused by earlier errors, bailing out
as expected.
Obviously my code is erroneous, but I presume it shouldn't cause an
'Internal compiler error'?
--- |================================================|
---- |-=| Dave Maley, M.A., M.Phil. |=-| ,---I
--- |================================================| |== U-----
--- | Computer Manager, St. Mary's College, Belfast | |== U (: |
--- |________________________________________________| | U----'-----
----- |________________________________/ ____====______| U' ()___(|
--- #__ //,-, ,-, ,-,\\ \| ///,-, ,-, \\ -------/,-,\_[
''( 0 )( 0 )( 0 )' o -''( 0 )( 0 ) \\#####====( 0 )
--------------'-'--'-'--'-'-------------------'-'--'-'--------------'-'----
More information about the Gcc-bugs
mailing list