fork download
  1. #include <iostream>
  2. #include <memory>
  3. using namespace std;
  4.  
  5. struct Die {
  6. ~Die () {
  7. std:: cout << "dead" << std::endl;
  8. }
  9. };
  10. struct Base {};
  11. struct Derived : public Base {
  12. std::unique_ptr<Die> ptr;
  13. };
  14.  
  15. int main() {
  16. std::unique_ptr<Base> p = std::make_unique<Derived>();
  17. // oops
  18. return 0;
  19. }
Success #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty