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

            Bug ID: 109367
           Summary: bogus -Wunused-function warning
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenb...@fh-soft.de
  Target Milestone: ---

% cat test.cpp
using T = decltype ([]{});
struct S { static void f(T); };
void S::f(T) {}
% g++ --std=c++20 -Wall -c test.cpp
test.cpp:3:6: warning: 'static void S::f(T)' defined but not used
[-Wunused-function]
    3 | void S::f(T) {}
      |      ^

This happens with decltype of a lambda or a type containing such (in my actual
use case, a multimap with a comparator defined this way) in the function's
arguments or return type.

The warning is bogus since static member functions can be accessed from
elsewhere.

Reply via email to