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

            Bug ID: 108802
           Summary: missed inlining of call via pointer to member function
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pobrn at protonmail dot com
  Target Milestone: ---

See https://gcc.godbolt.org/z/j833EGfGY

struct A {
    int f(int x) { return 2 * x; }
};

int f1() {
    A a;
    return [&](auto&& f) { return (a.*f)(42); } (&A::f);
}

clang optimizes `f1()` to `return 84`, but gcc does not do so. This seems to
have been changed somewhere between gcc 9 and 10 because 9.5 does the inlining
but 10.1 does not do it.

Reply via email to