Is this right, or a bug?

Nick Glencross nickg@glencros.demon.co.uk
Sat Feb 28 20:00:00 GMT 2004


Hi Guys,

I'm not sure if this is right or not. I've checked through 
http://gcc.gnu.org/bugs.html#cxx and can't see this listed.

What I've got boils down to is shown in the following example. Even 
though 'method(int a)' is defined in 'class1', it isn't available in 
'main' through 'class2'. There's a compiler error saying that 'method 
(int)' doesn't exist, only 'method ()'.

Changing 'method' to 'method2' in the lines highlighted, the problem 
goes away.

This makes me think that the clash with the virtual method is breaking 
things. Anyone know what is going ok?

Cheers,

Nick Glencross


========================================


// Abstract Baseclass
class class1
{
public:
                                                                                

    virtual void method (void) = 0;
                                                                                

    void method (int a) {} // If method2, this is ok
};
                                                                                

                                                                                

// Concrete Class
class class2 : public class1
{
public:
                                                                                

    void method (void) {} // If method2, this is ok
};
                                                                                

                                                                                

// Test
int main()
{
    class2 a;
    a.method (12);        // If method2, this is ok
}



More information about the Gcc-bugs mailing list