fork(3) download
  1. struct foo
  2. {
  3. operator bool() const
  4. {
  5. return true;
  6. }
  7.  
  8. template<typename T>
  9. operator T() const = delete;
  10. };
  11.  
  12.  
  13. int main()
  14. {
  15. foo f;
  16.  
  17. if( f == true);
  18. if( f );
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:17:12: error: use of deleted function ‘foo::operator T() const [with T = int]’
   if( f == true);
            ^
prog.cpp:9:3: error: declared here
   operator T() const = delete;
   ^
stdout
Standard output is empty