This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug with -Woverloaded-virtual on gcc 2.951
- To: robert dot hoehne at gmx dot net
- Subject: Re: Bug with -Woverloaded-virtual on gcc 2.951
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sat, 28 Aug 1999 22:11:40 +0200
- CC: gcc-bugs at gcc dot gnu dot org
- References: <199908251730.TAA04073@robby.dittmannsdorf.de>
> 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