<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 --- - C++ Member access control in explicit template instantiations not working"
   href="https://llvm.org/bugs/show_bug.cgi?id=27494">27494</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>C++ Member access control in explicit template instantiations not working
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>bugfinder1@gmx.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>These private member functions fail to compile when used as an argument of an
explicit template instantiation:
    - overloaded functions
    - static overloaded functions
    - templated functions

Consider the following code:

struct A
{
private:
    int func(int x) { return x; }   // overloaded
    int func(char x) { return x; }  // overloaded

    template <typename T>
    int funcT(T x) { return x; } // templated
};


template<int (A::*member)(int)>
struct B
{
};

template struct B<&A::func>;
template struct B<&A::funcT<int>>;

int main()
{
    return 0;
}


The C++ standard states in 14.7.2/12 [temp.explicit]:

    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. — end note ]</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>