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

--- Comment #2 from Luke Dalessandro <ldalessandro at gmail dot com> ---
It's also possible to workaround this with array allocation.

```
struct Foo {
    constexpr virtual ~Foo() {}
};

constexpr bool foo() {
    Foo *ptr = new Foo[1]{};
    delete [] ptr;
    return true;
}

static_assert(foo());
```

Obviously both of the workarounds require that we be able to cast from a `Foo*`
to our derived pointer, at which point we might as well skip the virtual
destructor and add an abstract `virtual void destroy() = 0` member where we can
just call `delete this` anyway.

Reply via email to