fork(7) download
  1. struct Base {
  2. virtual void foo () {}
  3. };
  4.  
  5. void foo (Base *p)
  6. {
  7. class Derived *pD = dynamic_cast<Derived*>(p);
  8. }
  9.  
  10. int main ()
  11. {
  12. }
  13.  
  14. struct Derived : Base {
  15. };
  16.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void foo(Base*)’:
prog.cpp:7: error: cannot dynamic_cast ‘p’ (of type ‘struct Base*’) to type ‘struct Derived*’ (target is not pointer or reference to complete type)
prog.cpp:7: warning: unused variable ‘pD’
stdout
Standard output is empty