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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2023-07-18 00:00:00         |2024-3-22

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I encountered this using std::pointer_traits<P>::pointer_to in constexpr code
like so:

#include <memory>

struct B { constexpr virtual ~B() = default; };
struct D : B { };

consteval void f()
{
  delete std::pointer_traits<B*>::pointer_to(*new D());
}

int main()
{
  f();
}


Which can be simplified to:

struct B { constexpr virtual ~B() = default; };
struct D : B { };

consteval void f()
{
  delete &(B&)*new D();
}

int main()
{
  f();
}

Reply via email to