Template bug
Peter Desantis
desantis@amazon.com
Thu Aug 24 14:27:00 GMT 2000
The GCC version
gcc version 2.95.2 19991024 (release)
The system type
Linux 2.2.15-az2smp #1 SMP Sun Jul 23 22:56:16 PDT 2000 i686 unknown
All options you passed to the compiler
"gcc"
Problem:
Appears to be related to providing a default implementation to pure
virtual functions in a templated class.
Source file:
#include <iostream>
template <class RT>
class A {
public:
A() { std::cerr << "Constucting A\n"; };
virtual bool foo (RT a) = 0;
};
template <class RT>
bool A<RT>::foo(RT a) {
std::cerr << "Executing A::foo() a = " << a << endl;
return true;
}
template <class RT>
class B : public A<RT> {
public:
B() { std::cerr << "Constructing B\n"; };
virtual bool foo (RT b);
};
template <class RT>
bool
B<RT>::foo(RT b) {
std::cerr << "Executing B::foo() b = " << b << endl;
return true;
}
void main () {
B<int> blah;
blah.foo(55);
}
More information about the Gcc-bugs
mailing list