[Bug c++/49574] Give a warning for insane overloading

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 29 09:03:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49574

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
           Severity|normal                      |enhancement

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-29 09:02:38 UTC ---
(In reply to comment #0)
> It would be nice to get some warning in case of library developers, for
> instance in the following situation:
> 
> foobar.h
> 
> Class FooBar 
> ...
> int foobar(int i, bool b = false);
> int foobar(int i);
> ...

Please provide working code and an example of the diagnostic you'd like to be
produced for that code.


> all the
> standalones will fail to compile and build their application.

Huh?  Why?

> There is no
> restriction to use those methods inside the library, thus the insane usage can
> remain hidden. 

Huh?

> It is debatable whether or not it should be a code analyzer task, but it is
> more serious issue than a directly unitialized warning or unused variable. I
> always get those for -Wall and it is less harm though. 

I disagree, using uninit'd data can lead to undefined behaviour, overloading is
always well-defined and predictable, even if it confuses some readers of the
code.



More information about the Gcc-bugs mailing list