fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct test
  5. {
  6. explicit operator bool() const { return true; }
  7. };
  8.  
  9. int main() {
  10. test a;
  11. float b = static_cast<float>(a);
  12. return 0;
  13. }
Compilation error #stdin compilation error #stdout 0s 3292KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:11:35: error: invalid static_cast from type ‘test’ to type ‘float’
     float b = static_cast<float>(a);
                                   ^
prog.cpp:11:11: warning: unused variable ‘b’ [-Wunused-variable]
     float b = static_cast<float>(a);
           ^
stdout
Standard output is empty