repo.or.cz
/
binutils-gdb.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Automatic date update in version.in
[binutils-gdb.git]
/
ld
/
testsuite
/
ld-elf
/
dl5.cc
blob
1cd33c061594a94978a8868bf7d6a3d5e84d69e7
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <new>
4
#include
"dl5.h"
5
6
int
pass
=
0
;
7
8
void
*
9
operator
new
(
size_t
sz
,
const
std
::
nothrow_t
&)
throw
()
10
{
11
void
*
p
;
12
pass
++;
13
p
=
malloc
(
sz
);
14
return
p
;
15
}
16
17
void
*
18
operator
new
(
size_t
sz
)
throw
(
std
::
bad_alloc
)
19
{
20
void
*
p
;
21
pass
++;
22
p
=
malloc
(
sz
);
23
return
p
;
24
}
25
26
void
27
operator
delete
(
void
*
ptr
)
throw
()
28
{
29
pass
++;
30
if
(
ptr
)
31
free
(
ptr
);
32
}
33
34
int
35
main
(
void
)
36
{
37
A
*
bb
=
new
A
[
10
];
38
foo
(
bb
);
39
delete
[]
bb
;
40
bb
=
new
(
std
::
nothrow
)
A
[
10
];
41
foo
(
bb
);
42
delete
[]
bb
;
43
44
if
(
pass
==
4
)
45
{
46
printf
(
"PASS
\n
"
);
47
return
0
;
48
}
49
else
50
{
51
printf
(
"FAIL
\n
"
);
52
return
1
;
53
}
54
}