fork download
  1. #include <iostream>
  2.  
  3. struct test {
  4. test() { std::cout << "test::test()\n"; }
  5. };
  6.  
  7. struct pod_or_not {
  8. int i;
  9. test t;
  10. };
  11.  
  12. int main() {
  13. std::cout << "auto storage:\n";
  14. pod_or_not pon;
  15. std::cout << "heap storage:\n";
  16. pod_or_not* ppon = new pod_or_not;
  17.  
  18. delete ppon;
  19. }
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
auto storage:
test::test()
heap storage:
test::test()