<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:andyg1001@hotmail.co.uk" title="Andy Gibbs <andyg1001@hotmail.co.uk>"> <span class="fn">Andy Gibbs</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - 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>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>FIXED
           </td>
           <td>---
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Friend function declarations hidden in qualifed name lookup (regression introduced by commit r350505)"
   href="https://bugs.llvm.org/show_bug.cgi?id=42513#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - 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:andyg1001@hotmail.co.uk" title="Andy Gibbs <andyg1001@hotmail.co.uk>"> <span class="fn">Andy Gibbs</span></a>
</span></b>
        <pre>Hi again,  I've been reviewing the fix for this bug and it seems it is still
incomplete, unfortunately.  Therefore, with your permission, I have re-opened
the bug.

The following is another code sample that was broken by commit r350505 but in
this case not fixed by commit r369384.  Again, the code sample compiled
correctly in clang 7.0 and compiles correctly in gcc.

/*******************************************************************/
template <typename X>
struct Instance
  {
  constexpr Instance(decltype(nullptr)) : x(nullptr) { }

  explicit constexpr operator bool() const
    { return (x != nullptr); }

  constexpr const X* operator->() const
    { return x; }

  private:
  constexpr Instance(const X* x) : x(x) { }

  friend constexpr auto GetInstanceImpl(X*)
    { return +[](){ return Instance<X>(&instance); }; }

  const X* x;
  static constexpr X instance { };
  };


struct GetInstanceHelper
  {
  template <typename Y, auto Ret = GetInstanceImpl((Y*)nullptr)>
  static constexpr auto GetInstance(Y*)
    { return Ret; }

  template <typename Y>
  static constexpr auto GetInstance(...)
    { return nullptr; }
  };

template <typename X>
static constexpr Instance<X> GetInstance()
  {
  constexpr auto i = GetInstanceHelper::GetInstance<X>(0);
  if constexpr (i != nullptr)
    return i();
  else
    return nullptr;
  }


struct X1
  {
  constexpr X1() { }
  friend constexpr auto GetInstanceImpl(X1*);
  constexpr int getValue() const
    { return 7; }
  };

template struct Instance<X1>;


constexpr int test()
  {
  int value = 0;
  if (auto i = GetInstance<X1>())
    value += i->getValue();
  return value;
  }

static_assert(test() == 7, "oops");
/*******************************************************************/</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>