title: Passing pointer to base class function as a template argument
body: <p>I have a template class <code>Tpl</code> which takes a class and a pointer to member function as a parameter.</p>
  
  <p>However when I attempt to pass a pointer to function that is actually inherited from the base class, I get an error <code>could not convert template argument bla bla bla</code> (see below)</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class Base
  {
  public:
      void func1 () {}
  };
  
  class Derived : public Base
  {
  public:
  };
  
  typedef void (Derived::*PF) ();
  
  template &lt;class T, void (T::*PF) ()&gt;
  class Tpl
  {
  public: 
  };
  
  int main()
  {
  
      PF pf = &amp;Derived::func1; // OK!
  
      Tpl &lt;Derived, &amp;Derived::func1&gt; t; // Error :
      // could not convert template argument ‘&amp;Base::func1’ to ‘void (Derived::*)()’  Tpl &lt;Derived, &amp;Derived::func1&gt; t
  
      return 0;
  }
  </code></pre>
  
  <p>Why is it that compiler can do implicit conversion when I assign <code>pf</code>, but not when I pass it as a template argument? And is there any way to overcome this other than doing <code>static_cast</code>?</p>