fork download
  1. #include <iostream>
  2. #include <new>
  3.  
  4. struct M{};
  5.  
  6. void * operator new (std::size_t size, const M & ) noexcept
  7. {
  8. std::cout << "call operator new" << std::endl ;
  9. return nullptr ;
  10. }
  11.  
  12.  
  13. int main() {
  14. int * p = new (M()) int() ;
  15. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
call operator new