Partial template specialisation bug in egcs-1.0.3

Christopher Eltschka Christopher_Eltschka@physik.tu-muenchen.de
Fri Dec 18 08:55:00 GMT 1998


This is actually a repost; however probably the original subject was
chosen badly (esp. the question mark in "(corrected in 1.1?)" might
easily be overlooked). So I thought I re-send it under a better
subject. (Note: I don't complain about the response time - I just think
it's due to my bad subject line, and this is the oly reason I re-send.)

The following program (doing partial template specialisation)

---------------------------------------------------
template<class T1, class T2> class X
{
};

template<class T> class X<T, void>
{
  class Y
  {
  };
};

X<int, void> a;
---------------------------------------------------

compiled with

  g++ -v testtd.cc

gives the following error messages:

---------------------------------------------------
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
 /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Di386
-D__i386__ -D__ELF__ -Dunix -Dlinux -D__i386__ -D__i386__ -D__ELF__
-D__unix__ -D__linux__ -D__i386 -D__unix -D__linux -Asystem(posix)
-D__EXCEPTIONS -Di386 -Di486 -Asystem(unix) -Acpu(i386) -Amachine(i386)
-D__i386__ -D__i486__ -Asystem(unix) -Acpu(i386) -Amachine(i386)
testtd.cc /tmp/cca00995
GNU CPP version egcs-2.90.29 980515 (egcs-1.0.3 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/cc1plus /tmp/cca00995 -quiet
-dumpbase testtd.cc -version -o /tmp/ccb00995
GNU C++ version egcs-2.90.29 980515 (egcs-1.0.3 release) (i486-linux)
compiled by GNU C version egcs-2.90.29 980515 (egcs-1.0.3 release).
testtd.cc:12: incorrect number of parameters (1, should be 2)
testtd.cc:2: in template expansion for decl `template <class T1, class
T2> X<T1,T2>'
testtd.cc:12: confused by earlier errors, bailing out
---------------------------------------------------

If I remove the nested class Y, or replace it with a typedef to int,
it works fine (however, a typedef to class {} again gives this error).
Just declaring the nested class (i.e. "class Y;" instead of "class Y
{};"
triggers the error es well.

Is this bug fixed in a later egcs?



More information about the Gcc-bugs mailing list