This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Template bug
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Template bug
- From: Peter Desantis <desantis at amazon dot com>
- Date: Thu, 24 Aug 2000 14:27:02 -0700
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);
}