Bug with -Woverloaded-virtual on gcc 2.951
Robert Hoehne
robert.hoehne@gmx.net
Wed Aug 25 10:30:00 GMT 1999
The -Woverloaded-virtual switch has a bug. At first it produces
a warning where it shouldn't and as second (more strong!) it
produces an error! Here the source file (tt.cc):
class BaseType
{
public:
virtual const BaseType & operator =(const char *);
};
template <class T>
class DBType_Ord : public BaseType
{
public:
DBType_Ord<T>();
virtual const BaseType & operator =(unsigned char);
};
BaseType *d;
void test()
{
d = new DBType_Ord<unsigned char>();
}
compiling with
gcc -c -Woverloaded-virtual tt.cc
produces:
tt.cc: In instantiation of `DBType_Ord<unsigned char>':
tt.cc:19: instantiated from here
tt.cc:4: warning: `BaseType::operator =(const char *)' was hidden
tt.cc:12: warning: by `DBType_Ord<unsigned char>::operator =(unsigned char)'
Robert
******************************************************
* email: Robert Hoehne <robert.hoehne@gmx.net> *
* Post: Am Berg 3, D-09573 Dittmannsdorf, Germany *
* WWW: http://www.tu-chemnitz.de/~sho/rho *
******************************************************
More information about the Gcc-bugs
mailing list