title: Resolution of built-in operator == overloads
body: <p>In the following code <code>struct A</code> has two implicit conversion operators to <code>char</code> and <code>int</code>, and an instance of the struct is compared for equality against integer constant <code>2</code>:</p>
  <pre><code>struct A {
      constexpr operator char() { return 1; }
      constexpr operator int() { return 2; }
  };
  static_assert( A{} == 2 );
  </code></pre>
  <p>The code passed fine in GCC and MSVC, but Clang complains:</p>
  <pre><code>&lt;source&gt;:5:20: error: use of overloaded operator '==' is ambiguous (with operand types 'A' and 'int')
  static_assert( A{} == 2 );
                 ~~~ ^  ~
  &lt;source&gt;:5:20: note: because of ambiguity in conversion of 'A' to 'float'
  &lt;source&gt;:2:15: note: candidate function
      constexpr operator char() { return 1; }
                ^
  &lt;source&gt;:3:15: note: candidate function
      constexpr operator int() { return 2; }
                ^
  &lt;source&gt;:5:20: note: built-in candidate operator==(float, int)
  static_assert( A{} == 2 );
                     ^
  &lt;source&gt;:5:20: note: built-in candidate operator==(double, int)
  &lt;source&gt;:5:20: note: built-in candidate operator==(long double, int)
  &lt;source&gt;:5:20: note: built-in candidate operator==(__float128, int)
  &lt;source&gt;:5:20: note: built-in candidate operator==(int, int)
  ...
  </code></pre>
  <p>Demo: <a href="https://gcc.godbolt.org/z/h9Kd66heM" rel="noreferrer">https://gcc.godbolt.org/z/h9Kd66heM</a></p>
  <p>The general question is which compiler right here? And in particular it is interesting to know why Clang does not prefer <code>operator==(int, int)</code>, however lists it among others?</p>