Index: test/test_exception_storage_nodynmem.pass.cpp =================================================================== --- test/test_exception_storage_nodynmem.pass.cpp +++ test/test_exception_storage_nodynmem.pass.cpp @@ -17,16 +17,28 @@ #include #include +#if defined(__APPLE__) +#include +#endif static bool OverwrittenCallocCalled = false; // Override calloc to simulate exhaustion of dynamic memory +#if !defined(__APPLE__) void *calloc(size_t, size_t) { +#else +void *calloc(malloc_zone_t *, size_t, size_t) { +#endif OverwrittenCallocCalled = true; return 0; } int main(int argc, char *argv[]) { +#if defined(__APPLE__) + malloc_zone_t *default_zone = malloc_default_zone(); + default_zone->calloc = calloc; +#endif + // Run the test a couple of times // to ensure that fallback memory doesn't leak. for (int I = 0; I < 1000; ++I)