C++ Warning for Base Class Overrides?

Jeffrey Walton noloader@gmail.com
Tue Aug 9 13:10:00 GMT 2011

On Tue, Aug 9, 2011 at 9:00 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 9 August 2011 13:49, Jeffrey Walton wrote:
>> On Tue, Aug 9, 2011 at 8:45 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>>> On 9 August 2011 12:38, Jeffrey Walton wrote:
>>>> I'm compiling with -Wall -Wextra on GCC. When I passed the dame code
>>>> through ICC, a few functions were flagged as unintentional overrides.
>>> Overrides?  Only a virtual function can be overridden.
>> My bad - I forgot the virtual.
> And the semi-colons, and the base class, so it's not surprising that
> example didn't produce any warnings.
I did a *really* bad job on that example.

>>> If you mean
>>> overloads, -Woverloaded-virtual will warn about virtual functions
>>> which are hidden by functions with the same name in a derived class.
>>> There's no warning for non-virtual functions which are hidden.
>> That's too bad. Itel's ICC caught the typos.
>> http://software.intel.com/en-us/articles/cdiag1125/.
> G++ gives the same warning for the example on that page.
Intersting. I did not get one from Ubuntu 10's version of g++ (4.4.3).
I cleaned and then compiled twice to make sure.


More information about the Gcc-help mailing list