ftmemsim-valgrind/memcheck/tests/new_override.cpp
Bart Van Assche 2393a4c5ca tests: Remove exception specifications
Exception specifications are a deprecated feature in C++11 and gcc 7
complains about these specifications. Hence remove these specifications.
This patch avoids that gcc reports the following:
    
  warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16360
2017-05-11 03:07:11 +00:00

32 lines
526 B
C++

#include <stdlib.h>
#include <stdio.h>
#include <new>
class Test {
public:
int a, b, c, d;
};
void *operator new[](size_t size)
{
void *ret = malloc(size);
printf("Here.\n");
for (unsigned int i = 0; i < size; i++) ((char *) ret)[i] = 0xFF;
return ret;
}
int main(int argc, char *argv[]) {
Test *toto;
int i;
int j = 0;
toto = new Test[2];
for (i = 0; i < 2; i++) {
if (toto[i].a) {
j++;
}
//printf("%d : %08x %08x %08x %08x\n", i, toto[i].a, toto[i].b, toto[i].c, toto[i].d);
}
}