title: Pointer to member type incompatible with object type when calling a pointer to a member of a derived class
body: <p>I have defined a class template such as this one:</p>
  
  <pre><code>template &lt;const category_id_t category, class Base&gt;
  class Node : public Base
  {
  ...
      template &lt;typename Derived, class T&gt;
      void on_message( const frame_t&amp; frame, void (Derived::*call)(const T*) )
      {
          if ( frame.length == sizeof(T) )
              (this-&gt;*(call))((T*)frame.data);
      }
  }
  </code></pre>
  
  <p>The argument <code>category</code> serves as a token to implement several similar classes and provide proper specialization according to specific categories. The above class is then derived like this:</p>
  
  <pre><code>template &lt;class Base&gt;
  class Sys : public Node&lt;CID_SYS, Base&gt;
  {
      Sys() : Node&lt;CID_SYS, Base&gt;() { /* ... */ }
      ....
  };
  </code></pre>
  
  <p>Class <code>Sys</code> is only a class that provides an base interface to objects of category <code>CID_SYS</code> (enum, value = 5) and serves as a base class to the actual implementation of the interface:</p>
  
  <pre><code>class SysImpl : public Sys&lt;CAN&gt;
  {
      ...
      /* Parse remote notifications */
      void on_notify( const state_info_t* ) { /* ... */ }
  };
  
  SysImpl sys;
  </code></pre>
  
  <p>Finally I have a function that calls the base class <code>Node&lt;CID_SYS, Base&gt;</code> member function <code>on_message()</code> like this:</p>
  
  <pre><code>void foo(const frame_t&amp; frame)
  { sys.on_message(frame, &amp;SysImpl::on_notify ); }
  </code></pre>
  
  <p>The compiler throws an error around the line <code>(this-&gt;*(call))((T*)frame.data)</code> saying</p>
  
  <blockquote>
    <p>error: pointer to member type 'void (SysImpl::)(const state_info_t*)' is incompatible with object type 'Node&lt;(category_id_t)5u, CAN>'</p>
  </blockquote>
  
  <p>The compiler has successfully guessed what template function to call, it's just that it doesn't seem to "recognize" that <code>this</code> is from a derived class.</p>
  
  <p>What I'd like is to call any member function of a class derived from <code>Node&lt;CID_SYS, CAN&gt;</code>, not only stand-alone functions (which works perfectly well so far, not shown in the excerpt above).</p>
  
  <p>What am I missing?</p>