fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct A;
  5. struct B;
  6.  
  7. int main() {
  8. A* aptr;
  9. B* bptr;
  10. bptr = dynamic_cast<B*>(aptr);
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:10:30: error: cannot dynamic_cast ‘aptr’ (of type ‘struct A*’) to type ‘struct B*’ (target is not pointer or reference to complete type)
  bptr = dynamic_cast<B*>(aptr);
                              ^
stdout
Standard output is empty