title: g++ is giving "unresolved overloaded function type" with template parameters
body: <p>Reduced to basic form, I'm trying to do something like this with a binary search tree:</p>
  
  <pre><code>template &lt;class Item, class Key&gt;
  class bst
  {
  public:
      Item val;
      Key key;
      bst *left;
      bst *right;
  private:
  };
  
  template &lt;class Item, class Key, class Process, class Param&gt;
  void preorder_processing1(bst&lt;Item, Key&gt; *root, Process f, Param g)
  {
      if (root == NULL) return;
      f(root-&gt;val, g);
      preorder_processing1(root-&gt;left, f, g);
      preorder_processing1(root-&gt;right, f, g);
  }
  
  template &lt;class Item, class Key&gt;
  void print_path(const bst&lt;Item, Key&gt;* root, const Key target)
  {
      if (root-&gt;key != target)
      {
          cout &lt;&lt; root-&gt;key &lt;&lt; " " &lt;&lt; root-&gt;val &lt;&lt; endl;
          if (target &lt; root-&gt;key)
              print_path(root-&gt;right, target);
          else
              print_path(root-&gt;left, target);
      }
      else
          cout &lt;&lt; root-&gt;key &lt;&lt; " " &lt;&lt; root-&gt;val &lt;&lt; endl;
  }
  
  template &lt;class Item, class Key&gt;
  void print_if_leaf(const bst&lt;Item, Key&gt;* test_node, const bst&lt;Item, Key&gt;* root)
  {
      if (test_node-&gt;right == NULL &amp;&amp; test_node-&gt;left == NULL)
      {
          print_path(root, test_node-&gt;key);
          cout &lt;&lt; endl;
      }
  }
  
  template &lt;class Item, class Key&gt;
  void print_paths_bst(const bst&lt;Item, Key&gt;* root)
  {
      preorder_processing1(root, print_if_leaf, root);
  }
  </code></pre>
  
  <p>When I call print_paths_bst, I get this: <code>error: no matching function for call to ‘preorder_processing1(const bst&lt;int, int&gt;*&amp;, &lt;unresolved overloaded function type&gt;, const bst&lt;int, int&gt;*&amp;)’</code></p>
  
  <p>I've tried forcing a cast on the preorder_processing1 call like         </p>
  
  <pre><code>preorder_processing1(root, print_if_leaf&lt;Item, Key&gt;, root);
  </code></pre>
  
  <p>...but this also hasn't resolved the problem.</p>
  
  <p>Does anyone see what's wrong with this?</p>