fork(1) download
  1. #include <iostream>
  2.  
  3. struct B;
  4.  
  5. struct A {
  6. A() = default;
  7.  
  8. operator (B *)() {
  9. return new B();
  10. }
  11. };
  12.  
  13. struct B { B() = default; };
  14.  
  15. int main() {
  16.  
  17. A a;
  18.  
  19. B *b = &a;
  20.  
  21. }
Compilation error #stdin compilation error #stdout 0s 2880KB
stdin
Standard input is empty
compilation info
prog.cpp:8:14: error: expected type-specifier before '(' token
prog.cpp: In function 'int main()':
prog.cpp:19:13: error: cannot convert 'A*' to 'B*' in initialization
stdout
Standard output is empty