This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello,
I cannot compile a code that seems correct to me. I have tried with gcc 3.3 and gcc 4.0.1 on MacOS X-ppc, and gcc 4.0.1 on Linux i686.
Here is the code, that uses pure virtual functions and simple inheritance.
//------------------------------------- struct a { virtual int foo() =0; virtual ~a(){} };
struct b : public a { virtual int foo(int a) =0; virtual ~b(){} };
struct c : public b
{
int test()
{
return (foo() + // <--- the compiler claims here that it cannot find foo()
foo(2));
}
virtual ~c(){}
};
This is not a bug in gcc. foo in b hides the one from a. You can "fix" the source by: struct b : public a { virtual int foo(int a) =0; using a::foo; virtual ~b(){} };
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |