This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Template instantiation of pure virtual method
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Template instantiation of pure virtual method
- From: David Heine <dlheine at carpathia dot stanford dot edu>
- Date: Sat, 11 Mar 2000 13:48:17 -0800
- Cc: David Heine <dlheine at carpathia dot stanford dot edu>
I just isolated an testcase for an internal compiler error in
gcc version 2.95.2 19991024 (release)
SunOS piglets 5.6 Generic_105181-15 sun4u sparc SUNW,Ultra-Enterprise
Here's the isolated testcase:
> cat f2.c
template <class T> class NGraph {
public:
virtual void remove_nnode(T *nnode) = 0;
};
template <class T>
void NGraph<T>::remove_nnode(T *nnode) {
}
template <class T> class NGraphBase : public NGraph<T> {
public:
NGraphBase() : NGraph<T>() {}
virtual void remove_nnode(T *nnode);
};
class ProcedureSymbol;
int main() {
NGraphBase<ProcedureSymbol> *b = new NGraphBase<ProcedureSymbol>();
};
> g++ -c f2.c
f2.c: In instantiation of `NGraph<ProcedureSymbol>::remove_nnode(ProcedureSymbol *)':
f2.c:19: instantiated from here
f2.c:6: Internal compiler error.
f2.c:6: Please submit a full bug report.
f2.c:6: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for instructions.
--------------------
The problem seems to occur because NGraph::remove_nnode(T*) is
declared to be abstract, but there is a template instantiation for it.
Clearly the above testcase is not valid c++ code, but I'm guessing
that an internal compiler error is overkill.
-David