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++/80598] New: -Wunused triggers for functions used in uninstantiated templates


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;
}

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