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]

bug report


Hi,

I am using gcc ver2.9.6. I think this is a bug of this release.
=========================================
class Base
{
public:
    Base& operator<< (char* str);
    Base& outStr(char* str);
};

class Derive : public Base
{
public:
    Derive operator<< (int* i) {}
    void f(char *str)
    {
        *this << str;    // compiler error reported:
                         // no match for `Derive & << char *&'
        outStr(str);     // OK
        Base::operator<<(str); // OK
        operator<<(str); // compiler error reported:
                         // no match for call to `Derive::operator<< (char
*&)'
    }
};
=========================================

The derived clase should be able to call any base class's functions
including operator functions without specifying the class name.

Thanks,

Shangwu





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]