[Bug c++/81618] Warn for unused functions declared in local scope
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 31 15:25:00 GMT 2017
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.
More information about the Gcc-bugs
mailing list