<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Unambiguous use of operator==considered ambiguous."
   href="https://bugs.llvm.org/show_bug.cgi?id=51887">bug 51887</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Unambiguous use of operator==considered ambiguous."
   href="https://bugs.llvm.org/show_bug.cgi?id=51887#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Unambiguous use of operator==considered ambiguous."
   href="https://bugs.llvm.org/show_bug.cgi?id=51887">bug 51887</a>
              from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
        <pre>The candidates here are:

1. bool operator==(T const&, T const&)
  with T = S<0>

2. bool operator==(S<I> const&, S<J> const&)
  from S<I>::operator==
  with I = 0, J = 0

In both cases, we have an identity conversion for both arguments. So the
candidates are not ordered by their argument conversions.

Next we consider whether one of the functions is more specialized than the
other. Deduction of the template arguments of (1) from (2) fails because we
deduce two different values for `T`. Deduction of the template arguments of (2)
from (1) fails because `T` is not of the form `S<I>`. So the templates are
unordered.

None of the other overload resolution tie-breakers apply either, so the call is
ambiguous.

EDG's compiler also rejects this in its conforming mode, but accepts in its
GCC-compatible mode, which tends to suggest that this is a GCC bug.

I also think that ambiguity is the expected result here: candidate (1) will
compare any two values of the same type, whereas candidate (2) will compare any
two Ss with potentially different I values. If we have two Ss with the same I,
it is not clear which one to use -- neither is looking for a more specific
situation.

Tentatively marking this invalid, but if you can point to where in the C++
standard it's specified that one of these two candidates is considered better,
we can revisit this.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>