This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81618] Warn for unused functions declared in local scope
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 31 Jul 2017 15:24:59 +0000
- Subject: [Bug c++/81618] Warn for unused functions declared in local scope
- Auto-submitted: auto-generated
- References: <bug-81618-4@http.gcc.gnu.org/bugzilla/>
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.