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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [testsuite/] [ld-elf/] [dl5.cc] - Blame information for rev 97

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

Line No. Rev Author Line
1 53 khays
#include <stdio.h>
2
#include <stdlib.h>
3
#include <new>
4
 
5
int pass = 0;
6
 
7
void *
8
operator new (size_t sz, const std::nothrow_t&) throw ()
9
{
10
  void *p;
11
  pass++;
12
  p = malloc(sz);
13
  return p;
14
}
15
 
16
void *
17
operator new (size_t sz) throw (std::bad_alloc)
18
{
19
  void *p;
20
  pass++;
21
  p = malloc(sz);
22
  return p;
23
}
24
 
25
void
26
operator delete (void *ptr) throw ()
27
{
28
  pass++;
29
  if (ptr)
30
    free (ptr);
31
}
32
 
33
class A
34
{
35
public:
36
  A() {}
37
  ~A() { }
38
  int a;
39
  int b;
40
};
41
 
42
 
43
int
44
main (void)
45
{
46
  A *bb = new A[10];
47
  delete [] bb;
48
  bb = new (std::nothrow) A [10];
49
  delete [] bb;
50
 
51
  if (pass == 4)
52
    {
53
      printf ("PASS\n");
54
      return 0;
55
    }
56
  else
57
    {
58
      printf ("FAIL\n");
59
      return 1;
60
    }
61
}

powered by: WebSVN 2.1.0

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