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

--- Comment #5 from Victor Do Nascimento <victor.donascimento at arm dot com> 
---
(In reply to Richard Biener from comment #3)
> a backport depends on r11-3610-gb6158faacbfb7d
> 
> Your reduced testcase doesn't compile since it references undeclared 'pobj'.

How embarassing. Accidentally deleted a line of code when clearing up
unnecessary comments.

If it is of any use, the working testcase is:

#include <memory>

struct gnu { };
bool check_new = false;
bool check_delete = false;

void*
operator new(std::size_t n) noexcept(false)
{
  check_new = true;
  return NULL;
}

void operator delete(void *v) noexcept
{
  check_delete = true;
  return;
}

void operator delete(void *v, std::size_t) noexcept
{
  ::operator delete(v);
}

void test01()
{
  std::allocator<gnu> obj;

  gnu* pobj = obj.allocate(256);

  if (!check_new)
    __builtin_abort();

  obj.deallocate(pobj, 256);
  if (!check_delete)
    __builtin_abort();
}

int main()
{
  test01();
  return 0;
}

Reply via email to