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]
Other format: [Raw text]

Re: c++/7780: -Woverloaded-virtual generating false-positives


On Thu, 2002-11-21 at 18:56, bangerth@dealii.org wrote:
> Synopsis: -Woverloaded-virtual generating false-positives
> 
> State-Changed-From-To: open->feedback
> State-Changed-By: bangerth
> State-Changed-When: Thu Nov 21 18:56:25 2002
> State-Changed-Why:
>     I think the example you give should indeed give a warning:
>     ----------------------
>     class A
>     {
>       public:
>         virtual int ThisFunctionShouldNotCauseAHidingWarning(char*);
>         virtual int ThisFunctionShouldNotCauseAHidingWarning(char*,int);
>     };
>     
>     class B : public A
>     {
>       public:
>         virtual int ThisFunctionShouldNotCauseAHidingWarning(char*,int);
>     };
>     
>     int main()
>     {
>       return 0;
>     }
>     -----------------------------------------
>     After all the virtual function in the derived class
>     hides indeed the one in the base class, independent of
>     the fact that there are _two_ functions in the base class
>     with the same name.
>     
>     What is it in this argumentation that you do not agree with?
> 
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7780

As I understood it, this warning was to alert the programmer when they
overload a (hopefully virutal) function that they intended to override.

I am thinking of examples like:
class A
{
  public:
    virtual int ThisFunctionShouldCauseAHidingWarning(int);
};

class B : public A
{
  public:
  virtual int ThisFunctionShouldCauseAHidingWarning(long);
};

If this was not the intent of this warning, perhaps another warning
should catch this case.

Thanks,

-Loren


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