[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fixing old code for GCC 3.2...



Marcelo E. Magallon wrote:
 In sort, this:

    class Base
    {
        public:
            virtual Base* foo();
    };

    class Derived : public Base
    {
        public:
            Derived* foo();
    };

 the foo() method returns a different type depending on the type of the
 object.

Of course, this specific example won't trigger the bug, as a Derived* has the same representation as a Base*, i.e. there is no pointer adjustment necessary. This was working in gcc since 2.8 or so.

A little more complicated is the case where Base is not the primary base
(e.g. when you have Derived: Other, Base); this case didn't work in 2.95, but does in 3.2.

The only unsupported case left is that of a virtual base.

Regards,
Martin




Reply to: