fork download
  1. #include <iostream>
  2.  
  3. struct Base {};
  4.  
  5. struct Derived : public Base {};
  6.  
  7. int main() {
  8. Derived ** d = nullptr;
  9. Base ** b = static_cast<Base **>(d);
  10.  
  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:9:36: error: invalid static_cast from type ‘Derived**’ to type ‘Base**’
  Base ** b = static_cast<Base **>(d);
                                    ^
prog.cpp:9:10: warning: unused variable ‘b’ [-Wunused-variable]
  Base ** b = static_cast<Base **>(d);
          ^
stdout
Standard output is empty