fork download
  1. #include <iostream>
  2.  
  3. struct S
  4. {
  5. S() { std::cout << "C-tor" << std::endl; }
  6. ~S() { std::cout << "D-tor" << std::endl; }
  7. };
  8.  
  9. int main()
  10. {
  11. void* memory = operator new(sizeof(S));
  12. S* p = new (memory) S();
  13. p->~S();
  14. operator delete(memory);
  15. }
Success #stdin #stdout 0.02s 2856KB
stdin
Standard input is empty
stdout
C-tor
D-tor