<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 FIXED - Friend function declarations hidden in qualifed name lookup (regression introduced by commit r350505)"
   href="https://bugs.llvm.org/show_bug.cgi?id=42513">bug 42513</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;">Status</td>
           <td>REOPENED
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Friend function declarations hidden in qualifed name lookup (regression introduced by commit r350505)"
   href="https://bugs.llvm.org/show_bug.cgi?id=42513#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Friend function declarations hidden in qualifed name lookup (regression introduced by commit r350505)"
   href="https://bugs.llvm.org/show_bug.cgi?id=42513">bug 42513</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 new testcase is also rejected by GCC 10 onwards. But it accepts with this
change:

-  if (auto i = GetInstance<X1>())
+  if (auto i = GetInstanceImpl((X1*)nullptr)())

whereas Clang rejects, saying:

<source>:59:16: error: function 'GetInstanceImpl' with deduced return type
cannot be used before it is defined
  if (auto i = GetInstanceImpl((X1*)nullptr)())
               ^

... which gives a suggestion as to what's going wrong. Here's a reduced
testcase:

template<typename X> struct T { friend auto f(X*) {} };
struct X1 { friend auto f(X1*); };
template struct T<X1>;
void g() { f((X1*)nullptr); }

It turns out that when looking for a definition to instantiate in order to
resolve an undeduced return type, we didn't check for the case of a function
for which a different redeclaration was instantiated from a friend definition.

Fixed in dd8297b0669f8e69b03ba40171b195b5acf0f963.</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>