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]

[Bug c++/81618] Warn for unused functions declared in local scope


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81618

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-07-31
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
This request makes sense to me as an enhancement to -Wunused-function.   With
all the different forms of initialization in C++, it's not rare to accidentally
declare a function when a variable is intended, e.g., like so:

  template <class T>
  void f ()
  {
    T x ();       // declares an external function
    T y (T ());   // ditto
  }

These mistakes are usually exposed when the symbol is used in a context where
an object is expected but extending -Wunused-function to diagnose locally
declared functions would help detect those that are not.

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