[Bug c++/110714] constexpr lifetime error: base class this pointer
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 18 12:46:04 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110714
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-07-18
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note this works on the trunk:
```
struct Base
{
constexpr virtual ~Base() {}
// constexpr Base* get_this() { return this; }
int x;
};
struct Derived : public Base {};
constexpr bool test()
{
Derived* pf = new Derived;
Base* t = pf;
delete t;
return true;
}
constexpr bool b = test();
```
More information about the Gcc-bugs
mailing list