1#include <stdio.h> // fprintf(), NULL 2#include <stdlib.h> // exit(), EXIT_SUCCESS 3 4#include "test.h" // PASS(), FAIL(), XPASS(), XFAIL() 5 6#include <stdlib.h> 7#include <new> 8 9 10extern char* foo(); 11 12static char all[] = "hello"; 13 14void* operator new[](std::size_t) throw (std::bad_alloc) 15{ 16 return all; 17} 18 19 20int main() 21{ 22 char* newArray = new char[24]; 23 char* fromFoo = foo(); 24 25 if ( fromFoo == newArray ) 26 PASS("operator-new-dylib"); 27 else 28 FAIL("operator-new-dylib"); 29 return EXIT_SUCCESS; 30} 31 32