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

            Bug ID: 118352
           Summary: final virtual dtor allows for class to be treated as
                    final for devirtualization
           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: ---

Split off from PR 94243 since the others there have static_cast being involved
while this one does not.

Take:
```
namespace Test2a {
  struct A {
    virtual ~A() final {}
    virtual int f();
  };

  // CHECK-LABEL: define i32 @_ZN6Test2a1fEPNS_1AE
  int f(A *a) {
    // CHECK: call i32 @_ZN6Test2a1A1fEv
    return a->f();
  }
}
```

The front-end should be able to treat the `A` class as being final for
devirtualization reasons because a class cannot extend it.

Reply via email to