<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Bogus access error when befriending a member function template specialization"
   href="https://llvm.org/bugs/show_bug.cgi?id=30859">30859</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bogus access error when befriending a member function template specialization
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rs2740@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>From <a href="http://stackoverflow.com/q/40350327/2756719">http://stackoverflow.com/q/40350327/2756719</a>. Repro:

struct X
{
    template <class T> static void f() { g<T>(); }
private:
    template <class T> static void g() {};
};

struct Y
{
    friend void X::f<Y>(); /// #1
};

int main() 
{
    X::f<Y>();
}

results in the following obviously bogus error:

prog.cc:3:42: error: 'g' is a private member of 'X'
    template <class T> static void f() { g<T>(); }
                                         ^~~~
prog.cc:15:8: note: in instantiation of function template specialization
'X::f<Y>' requested here
    X::f<Y>();
       ^
prog.cc:5:36: note: declared private here
    template <class T> static void g() {};
                                   ^
1 error generated.

Commenting out line #1 makes the code compile, suggesting that somehow the
friend declaration caused the access checking to be done in the wrong context.</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>