Topic: virtual function returns; using mi.


Author: sgarland@world.std.com (Scott Garland)
Date: Mon, 3 Oct 1994 01:59:03 GMT
Raw View
        i've run into a smallish problem, and i'm curious what
the 'standard' has to say about it...


class A { };

class B : public virtual base {
public:
        virtual A* refer() const;
};


class C : public virtual base {
public:
        virtual C* refer() const;
};


class D : public B, public C {
public:
        virtual B* refer() const;
};

        now, the above code works on every compiler i have
(Lucid, GCC, SunPRO C++ 4.0); however, it has stopped working
using SunPRO C++ 4.0.1, producing this message:

Error: Virtual function D::refer() returns B*, while C::refer() returns C*.

        has something changed in the 'standard' that may have
led SunPRO 4.0.1 to disallow what i'm doing; or is the
compiler mistaken; or am i doing something "wrong."

thanks,
scott garland
508 457 4876