boost::bind don't compile with member template function
<p>I just write an simple example to test boost::bind. I use it to instantiate a template member function, but it won't compile with g++ 4.6.0. I don't know what's the problem.
Here's the code:</p>

<pre><code>#include &lt;boost/bind.hpp&gt;

struct Functor
{
  void operator()()
  {

  }
};

struct DerivedFinishAction
{
  DerivedFinishAction()
  {}

  void Inc()
  {

  }

  template &lt;typename T&gt;
  void TmplFunc(T t)
  {
    (boost::bind(&amp;DerivedFinishAction::BindFunc&lt;T&gt;, this , t))();
  }

  template &lt;typename T&gt;
  void BindFunc(T t)
  {
    t();
  }

  void Func()
  {
    Functor f;
    TmplFunc(f); // this is OK
    TmplFunc(boost::bind(&amp;DerivedFinishAction::Inc, this)); // compile error
  }
};

int main(int argc, char *argv[])
{

  return 0;
}
</code></pre>

<p>And g++ gives the following errors:</p>

<pre><code>In file included from /usr/include/boost/bind.hpp:22:0,
                 from testBind.cpp:1:
/usr/include/boost/bind/bind.hpp: In member function ‘void boost::_bi::list2&lt;A1, A2&gt;::operator()(boost::_bi::type&lt;void&gt;, F&amp;, A&amp;, int) [with F = boost::_mfi::mf1&lt;void, DerivedFinishAction, boost::_bi::bind_t&lt;void, boost::_mfi::mf0&lt;void, DerivedFinishAction&gt;, boost::_bi::list1&lt;boost::_bi::value&lt;DerivedFinishAction*&gt; &gt; &gt; &gt;, A = boost::_bi::list0, A1 = boost::_bi::value&lt;DerivedFinishAction*&gt;, A2 = boost::_bi::bind_t&lt;void, boost::_mfi::mf0&lt;void, DerivedFinishAction&gt;, boost::_bi::list1&lt;boost::_bi::value&lt;DerivedFinishAction*&gt; &gt; &gt;]’:
/usr/include/boost/bind/bind_template.hpp:20:59:   instantiated from ‘boost::_bi::bind_t&lt;R, F, L&gt;::result_type boost::_bi::bind_t&lt;R, F, L&gt;::operator()() [with R = void, F = boost::_mfi::mf1&lt;void, DerivedFinishAction, boost::_bi::bind_t&lt;void, boost::_mfi::mf0&lt;void, DerivedFinishAction&gt;, boost::_bi::list1&lt;boost::_bi::value&lt;DerivedFinishAction*&gt; &gt; &gt; &gt;, L = boost::_bi::list2&lt;boost::_bi::value&lt;DerivedFinishAction*&gt;, boost::_bi::bind_t&lt;void, boost::_mfi::mf0&lt;void, DerivedFinishAction&gt;, boost::_bi::list1&lt;boost::_bi::value&lt;DerivedFinishAction*&gt; &gt; &gt; &gt;, boost::_bi::bind_t&lt;R, F, L&gt;::result_type = void]’
testBind.cpp:24:5:   instantiated from ‘void DerivedFinishAction::TmplFunc(T) [with T = boost::_bi::bind_t&lt;void, boost::_mfi::mf0&lt;void, DerivedFinishAction&gt;, boost::_bi::list1&lt;boost::_bi::value&lt;DerivedFinishAction*&gt; &gt; &gt;]’
testBind.cpp:37:58:   instantiated from here
/usr/include/boost/bind/bind.hpp:313:9: error: invalid use of void expression
</code></pre>

<p>Can anybody help explain this? Why the first instantiation is OK while the second one causes compile error?</p>
