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

            Bug ID: 119113
           Summary: missed optimization with `pointer to member function`
                    with non-direct usage
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
struct TestObject {
    void f() const { }
};
TestObject p;
void (TestObject::*pmf)() const = &TestObject::f;
void doTest1() {
    ((&((void)1, p))->*(pmf))();
}
void doTest2() {
    ((&(p))->*(pmf))();
}
```

Both should be optimized to so there is no check that pmf is virtual method but
doTest1 still has the check.

Reply via email to