@no_asan('SAFE_HEAP cannot be used with ASan')
def test_segfault(self):
    self.set_setting('SAFE_HEAP', 1)
    for addr in ['0', 'new D2()']:
        print(addr)
        src = ('\n        #include <stdio.h>\n\n        struct Classey {\n          virtual void doIt() = 0;\n        };\n\n        struct D1 : Classey {\n          virtual void doIt() { printf("fleefl\\n"); }\n        };\n\n        struct D2 : Classey {\n          virtual void doIt() { printf("marfoosh\\n"); }\n        };\n\n        int main(int argc, char **argv)\n        {\n          Classey *p = argc == 100 ? new D1() : (Classey*)%s;\n\n          p->doIt();\n\n          return 0;\n        }\n      ' % addr)
        self.do_run(src, ('segmentation fault' if addr.isdigit() else 'marfoosh'), assert_returncode=None)
@no_asan('SAFE_HEAP cannot be used with ASan')
def test_segfault(self):
    self.set_setting('SAFE_HEAP', 1)
    for addr in ['0', 'new D2()']:
        print(addr)
        src = ('\n        #include <stdio.h>\n\n        struct Classey {\n          virtual void doIt() = 0;\n        };\n\n        struct D1 : Classey {\n          virtual void doIt() { printf("fleefl\\n"); }\n        };\n\n        struct D2 : Classey {\n          virtual void doIt() { printf("marfoosh\\n"); }\n        };\n\n        int main(int argc, char **argv)\n        {\n          Classey *p = argc == 100 ? new D1() : (Classey*)%s;\n\n          p->doIt();\n\n          return 0;\n        }\n      ' % addr)
        self.do_run(src, ('segmentation fault' if addr.isdigit() else 'marfoosh'), assert_returncode=None)