OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [eh/] [new1.C] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// PR c++/5757
2
// Test that when a constructor throws in a new-expression, we pass the
3
// right pointer to operator delete.
4
 
5
// { dg-do run }
6
 
7
#include 
8
 
9
int ret = 1;
10
 
11
void *ptr;
12
void * operator new[] (size_t s) throw (std::bad_alloc)
13
{
14
  ptr = operator new (s);
15
  return ptr;
16
}
17
 
18
void operator delete[] (void *p) throw ()
19
{
20
  if (p == ptr)
21
    ret = 0;
22
  operator delete (p);
23
}
24
 
25
struct A
26
{
27
  A() { throw 1; }
28
  ~A() {}
29
};
30
 
31
int
32
main ()
33
{
34
  try
35
    {
36
      A *p = new A[4];
37
    }
38
  catch (...) {}
39
  return ret;
40
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.