<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - C++ standard violation: [templates][explicit instantiation][access checking][pointer to overloaded member function]"
   href="https://bugs.llvm.org/show_bug.cgi?id=35647">35647</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>C++ standard violation: [templates][explicit instantiation][access checking][pointer to overloaded member function]
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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++11
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>C++11 Standard / 14.7.2 (Explicit instantiation) / 12:
The usual access checking rules do not apply to names used to specify explicit
instantiations. [Note: In particular, the template arguments and names used in
the function declarator (including parameter types, return types and exception
specifications) may be private types or objects which would normally not be
accessible and the template may be a member template or member function which
would not normally be accessible. â€”endnote]

If there is non-overloaded member function Clang complies to the standard,
however if there is an overloaded member function it does not.
Code below:

template <typename PtrType, PtrType PtrValue, typename TagType>
struct private_access {
  friend PtrType get(TagType) { return PtrValue; }
};

class Foo
{
  void print0(int);
  void print();
  void print(int);
};

using A = void(int);
using B = A Foo::*;
struct Tag {};
template struct private_access<B, &Foo::print0, Tag>;// OK
template struct private_access<B, &Foo::print, Tag>; // ERROR, OK in GCC

int main() { return 0; }</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>