This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80598] New: -Wunused triggers for functions used in uninstantiated templates
- From: "jens.maurer at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 May 2017 20:42:22 +0000
- Subject: [Bug c++/80598] New: -Wunused triggers for functions used in uninstantiated templates
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80598
Bug ID: 80598
Summary: -Wunused triggers for functions used in uninstantiated
templates
Product: gcc
Version: 7.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jens.maurer at gmx dot net
Target Milestone: ---
The all-new gcc 7.1.0 now shows this disturbing warning; gcc 6.3.0 didn't. It
seems unhelpful to issue an "unused function" warning for a function actually
used from an uninstantiated template. This situation might happen a lot in
#included header files. (Adding an instantiation of "g" silences the warning.)
$ g++ -Wunused x.cc
x.cc:1:13: warning: ‘void f()’ defined but not used [-Wunused-function]
static void f()
{ }
template<class T>
int g(T x)
{
f();
return 0;
}