Add 469782 to NEWS
[valgrind.git] / memcheck / tests / new_override.cpp
blob3331225205c9bc50902506b8b878f1e9a6c73682
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <new>
5 class Test {
6 public:
7 int a, b, c, d;
8 };
10 void *operator new[](size_t size)
12 void *ret = malloc(size);
13 printf("Here.\n");
14 for (unsigned int i = 0; i < size; i++) ((char *) ret)[i] = 0xFF;
15 return ret;
18 int main(int argc, char *argv[]) {
19 Test *toto;
20 int i;
21 volatile int j = 0;
23 toto = new Test[2];
25 for (i = 0; i < 2; i++) {
26 if (toto[i].a) {
27 j++;
29 //printf("%d : %08x %08x %08x %08x\n", i, toto[i].a, toto[i].b, toto[i].c, toto[i].d);