<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 - Overloaded method pointer's public/private access isn't resolved correctly"
   href="https://bugs.llvm.org/show_bug.cgi?id=32898">32898</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Overloaded method pointer's public/private access isn't resolved correctly
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.0
          </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>russ.schaaf@superevilmegacorp.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code fails to compile on clang 4.0.0 - it compiles with earlier
versions of clang, as well as several other compilers I've tried:



template<typename T, void(T::*pMethod)()>
void methodThunk() {}

// If this isn't a template function, the code compiles
template<typename Type> 
void registerCallback(void(*fn)()) {}

class C
{
public:
    // Commenting this overload out makes the code compile 
    void onUpdate(int i) {} // Unrelated overload, with no implementation

private:
    void onUpdate() {} // This is the one I want to use for a template arg

    void doSomething()
    {
        // ERROR IS HERE   -------------------v
        registerCallback<int>(&methodThunk<C, &C::onUpdate>);
    }
};



Error is:

<source>:20:51: error: 'onUpdate' is a private member of 'C'
        registerCallback<int>(&methodThunk<C, &C::onUpdate>);
                                               ~~~^~~~~~~~
<source>:20:32: note: while substituting explicitly-specified template
arguments into function template 'methodThunk' 
        registerCallback<int>(&methodThunk<C, &C::onUpdate>);
                               ^
<source>:20:9: note: while substituting deduced template arguments into
function template 'registerCallback' [with Type = int]
        registerCallback<int>(&methodThunk<C, &C::onUpdate>);
        ^
1 error generated.
Compiler exited with result code 1</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>