title: Why do switch and if statements behave differently with conversion operators?
body: <p>Why do <code>switch</code> and <code>if</code> statements behave differently with conversion operators?</p>
  
  <pre><code>struct WrapperA
  {
      explicit operator bool() { return false; }    
  };
  
  struct WrapperB
  {
      explicit operator int() { return 0; }
  };
  
  int main()
  {
      WrapperA wrapper_a;
      if (wrapper_a) { /** this line compiles **/ }
  
      WrapperB wrapper_b;
      switch (wrapper_b) { /** this line does NOT compile **/ }
  }
  </code></pre>
  
  <p>The compilation error is <code>switch quantity is not an integer</code> while in the <code>if</code> statement it is perfectly recognized as a <code>bool</code>. (GCC)</p>