Invalid operand 'unknown type' on pure virtual methods
Emmanuel Millon
emmanuel.millon@voila.fr
Mon Feb 7 02:23:00 GMT 2000
Hi,
On a Linux OS v2.2.5 and with the gcc v2.95.2.19991024 (release), I'm
getting the following error:
invalid operands '{unknown type}' and '{unknown}' to binary operator ==,
on the following sample (compiling with -O0 -g3 -Wall -fpermissive -c
flags):
( - fpermissive to avoid some problem like this "const
anyDeclarationWithNoType = 0;")
#include <iostream.h>
#include <stdlib.h>
class A
{
public:
virtual void Test() = 0;
};
class B : public A
{
public:
virtual void Test() { cout << "Test Class B" << endl; }
};
class C : public A
{
public:
virtual void Test() { cout << "Test Class C" << endl; }
};
int main(int argc, char *argv[])
{
A *a1,*a2;
B b;
C c;
a1 = &b;
a2 = &c;
bool test = a1->Test==a2->Test; // I'm getting the error here!!!
return 0;
}
Is there a special flag to disable this error? (runs on CodeWarrior,
Visual C++...)
Thanks for any answer.
More information about the Gcc-bugs
mailing list