fork download
  1. #include <memory>
  2.  
  3. struct A;
  4.  
  5. struct B {
  6. typedef std::shared_ptr<B> Ptr;
  7. };
  8.  
  9. struct A {
  10. operator B::Ptr() {
  11. return std::make_shared<B>();
  12. }
  13. };
  14.  
  15. int main() {
  16. A* a = new A;
  17. B::Ptr{*a};
  18. }
Success #stdin #stdout 0s 3016KB
stdin
Standard input is empty
stdout
Standard output is empty