template class support in egcs-970907

Weiwen Liu liu@hepunix.physics.yale.edu
Mon Sep 8 10:09:00 GMT 1997


Hi,

New gcc in egcs-970907 fails to compile the following program, while
egcs-970904 succeeded.

// This example compiles using the new STL<ToolKit> from ObjectSpace,
Inc.
// STL<ToolKit> is the EASIEST to use STL that works on most platform/compiler 
// combinations, including cfront, Borland, Visual C++, C Set++, ObjectCenter, 
// and the latest Sun & HP compilers. Read the README.STL file in this 
// directory for more information, or send email to info@objectspace.com.
// For an overview of STL, read the OVERVIEW.STL file in this directory.

#include <iostream.h>
#include <vector.h>
#include <algo.h>

int main ()
{
  vector<int> v1; // Empty vector of integers.
  cout << "empty = " << v1.empty () << endl;
  cout << "size = " << v1.size () << endl;
  cout << "max_size = " << v1.max_size () << endl;
  v1.push_back (42); // Add an integer to the vector.
  cout << "size = " << v1.size () << endl;
  cout << "v1[0] = " << v1[0] << endl;
  return 0;
}

Reading specs from /data/dsk6/liu/ncftp/egcs-970907/gcc/stage2/specs
gcc version egcs-2.90.06 970907 (gcc2-970802 experimental)
 /data/dsk6/liu/ncftp/egcs-970907/gcc/stage2/cpp -lang-c++ -v -isystem /data/dsk6/liu/ncftp/egcs-970907/gcc/include -isystem /data/dsk6/liu/ncftp/egcs-970907/gcc/stage2/include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dunix -D__
osf__ -D__alpha -D__alpha__ -D_LONGLONG -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__unix__ -D__osf__ -D__alpha -D__alpha__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix -D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -Acpu(alpha) -Amachine(alpha) -D__EXCEPTION
S -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C vec1.cpp /tmp/ccaasBCa.ii
GNU CPP version egcs-2.90.06 970907 (gcc2-970802 experimental)
#include "..." search starts here:
#include <...> search starts here:
 /project/dsk6/liu/local/include
 /data/dsk6/liu/ncftp/egcs-970907/gcc/include
 /project/dsk6/liu/local/include/g++
 /project/dsk6/liu/local/alpha-dec-osf4.0/include
 /project/dsk6/liu/local/lib/gcc-lib/alpha-dec-osf4.0/egcs-2.90.06/include
 /usr/include
End of search list.
 /data/dsk6/liu/ncftp/egcs-970907/gcc/stage2/cc1plus /tmp/ccaasBCa.ii -quiet -dumpbase vec1.cc -version -o /tmp/ccaasBCa.s
GNU C++ version egcs-2.90.06 970907 (gcc2-970802 experimental) (alpha-dec-osf4.0) compiled by GNU C version egcs-2.90.06 970907 (gcc2-970802 experimental).
In file included from /project/dsk6/liu/local/include/g++/algobase.h:33,
                 from /project/dsk6/liu/local/include/g++/vector.h:31,
                 from vec1.cpp:9:
/project/dsk6/liu/local/include/g++/pair.h:43: parse error before `template'
/project/dsk6/liu/local/include/g++/pair.h:44: missing ';' before right brace
/project/dsk6/liu/local/include/g++/pair.h:46: parse error at null character
/project/dsk6/liu/local/include/g++/pair.h:59: semicolon missing after declaration of `struct pair<T1,T2>'
In file included from vec1.cpp:9:
/project/dsk6/liu/local/include/g++/vector.h:94: parse error before `template'
/project/dsk6/liu/local/include/g++/vector.h:108: destructors must be member functions
/project/dsk6/liu/local/include/g++/vector.h:108: return type specification for destructor invalid
/project/dsk6/liu/local/include/g++/vector.h:108: declaration of template `template <class T, class Alloc = class __default_alloc_template<false,0>> void vector()'
/project/dsk6/liu/local/include/g++/vector.h:35: conflicts with previous declaration `template <class T, class Alloc = class __default_alloc_template<false,0>> class vector<T,Alloc>'
/project/dsk6/liu/local/include/g++/vector.h:35: previous non-function declaration `template <class T, class Alloc = class __default_alloc_template<false,0>> class vector<T,Alloc>'
/project/dsk6/liu/local/include/g++/vector.h:108: conflicts with function declaration `template <class T, class Alloc = class __default_alloc_template<false,0>> void vector()'
/project/dsk6/liu/local/include/g++/vector.h:112: `T' was not declared in this scope
/project/dsk6/liu/local/include/g++/vector.h:112: `Alloc' was not declared in this scope
/project/dsk6/liu/local/include/g++/vector.h:112: confused by earlier errors, bailing out




More information about the Gcc-bugs mailing list