This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Possible bug in g++ (egcs-20000612)
- To: bug-gcc at gnu dot org
- Subject: Possible bug in g++ (egcs-20000612)
- From: Derrick Bass <derrick at tapir dot caltech dot edu>
- Date: Thu, 15 Jun 2000 05:42:42 -0700
This may be a bug, or it may be my seemingly inexhaustible ignorance of
C++ template syntax. If the latter, please forgive. . .
Anyway, either g++ or I seem to be having trouble with partial
specialization of member templates. The following code does not
compile under gcc-2.95.2 nor under v. 20000612
-------------------------------------------------------
template<class T>
class A {
};
class X {
public:
template <class T> void func(T);
// Uncommenting this line makes it work:
// template<class T> void func(A<T>);
};
// Complete specialization: ok
template<>
void X::func(int) {
}
// partial specialization broken ?
template<class T>
void X::func(A<T>) {
}
--------------------------------------------------------
However, if the commented out code is included, then it will compile.
Here is the output from gcc -v:
Reading specs from /ufs/murphy/derrick/gnu/egcs-20000612/lib/gcc-lib/i686-pc-linux/2.96/specs
gcc version 2.96 20000612 (experimental)
/ufs/murphy/derrick/gnu/egcs-20000612/lib/gcc-lib/i686-pc-linux/2.96/cpp -lang-c++ -v -iprefix /ufs/murphy/derrick/bin/../lib/gcc-lib/i686-pc-linux/2.96/ -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__cplusplus -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_pentiumpro__ partial.cc /tmp/cccHaCfJ.ii
GNU CPP version 2.96 20000612 (experimental) (cpplib)
(i386 Linux/ELF)
ignoring nonexistent directory `/ufs/murphy/derrick/include/g++-3'
ignoring nonexistent directory `/ufs/murphy/derrick/lib/gcc-lib/i686-pc-linux/2.96/include'
ignoring nonexistent directory `/ufs/murphy/derrick/i686-pc-linux/include'
#include "..." search starts here:
#include <...> search starts here:
/ufs/murphy/derrick/gnu/egcs-20000612/include/g++-3
/usr/local/include
/ufs/murphy/derrick/gnu/egcs-20000612/lib/gcc-lib/i686-pc-linux/2.96/include
/ufs/murphy/derrick/gnu/egcs-20000612/i686-pc-linux/include
/usr/include
End of search list.
/ufs/murphy/derrick/gnu/egcs-20000612/lib/gcc-lib/i686-pc-linux/2.96/cc1plus /tmp/cccHaCfJ.ii -quiet -dumpbase partial.cc -version -o /tmp/ccayeQnm.s
GNU C++ version 2.96 20000612 (experimental) (i686-pc-linux) compiled by GNU C version 2.96 20000612 (experimental).
partial.cc:19: prototype for `void X::func (A<T>)' does not match any
in class `X'
partial.cc:7: candidate is: template <class T> void X::func (T)
partial.cc:19: template definition of non-template `void X::func
(A<T>)'