fork download
  1. struct Y
  2. {
  3. explicit operator bool() const { return true; } // explicit requires std=c++0x
  4. };
  5.  
  6. int main()
  7. {
  8. Y a,b,c;
  9.  
  10. bool x = (bool) b; // cast required
  11.  
  12. if (a && b || c) { } // cast not required
  13. if (a) { } // cast not required
  14.  
  15. for (;c;) { break; }
  16. }
  17.  
Success #stdin #stdout 0s 2880KB
stdin
Standard input is empty
stdout
Standard output is empty