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

            Bug ID: 89105
           Summary: -Wabi warns for functions with internal linkage
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

// { dg-options "-fabi-version=12 -Wabi=11" }

namespace {
  template<typename F>
    void run(F f, int i)
    {
      f(i);
    }
}

void f()
{
  run([](int) { }, 1);
}


wabi.cc: In function ‘void f()’:
wabi.cc:13:6: warning: empty class ‘f()::<lambda(int)>’ parameter passing ABI
changes in -fabi-version=12 (GCC 8) [-Wabi]
   run([](int) { }, 1);
   ~~~^~~~~~~~~~~~~~~~
wabi.cc: In function ‘void {anonymous}::run(F, int) [with F =
f()::<lambda(int)>]’:
wabi.cc:5:10: warning: empty class ‘f()::<lambda(int)>’ parameter passing ABI
changes in -fabi-version=12 (GCC 8) [-Wabi]
     void run(F f, int i)
          ^~~

This seems like a false position, because the function cannot be called from
outside the current translation unit. It has internal linkage, and its address
is never taken.

Making it static instead of using an unnamed namespace doesn't change anything.

Reply via email to