fork download
  1. #include <iostream>
  2.  
  3. struct A {
  4. void operator()() { std::cout << "foo" << std::endl; }
  5. };
  6.  
  7. struct B {
  8. A* operator->() { return (A*)0; }
  9. };
  10.  
  11. struct C {
  12. B& operator->() { return *(B*)0; }
  13. };
  14.  
  15. struct D {
  16. C& operator->() { return *(C*)0; }
  17. };
  18.  
  19. int main()
  20. {
  21. D()->operator()();
  22. }
  23.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
foo