drd: Add a consistency check
[valgrind.git] / memcheck / tests / new_override.cpp
blob200173617c2fee8038d70f37363192b4735da713
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) throw(std::bad_alloc)
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 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);