This is the mail archive of the gcc-bugs@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]

Re: Bug with -Woverloaded-virtual on gcc 2.951


> 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!
[...]
> 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)'

Thanks for your bug report. I fail to see the error, though: the
compiler produces only warnings. What makes you think you get an
error?

Furthermore, the warning is according to the specification:

# Warn when a derived class function declaration may be an error in
# defining a virtual function.  In a derived class, the definitions of
# virtual functions must match the type signature of a virtual
# function declared in the base class.  With this option, the compiler
# warns when you define a function with the same name as a virtual
# function, but with a type signature that does not match any
# declarations from the base class.

So you have a virtual operator= in the base class and the derived
class, but they don't match in signature - this is when the error is
flagged.

Hope this helps,
Martin


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