title: Understanding a "template argument is invalid" error message
body: <p>Consider the code:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;type_traits&gt;
  #include &lt;iostream&gt;
  
  struct test1 {
      void Invoke() {};
  };
  
  struct test2 {
      template&lt;typename&gt; void Invoke() {};
  };
  
  
  enum class InvokableKind {
      NOT_INVOKABLE,
      INVOKABLE_FUNCTION,
      INVOKABLE_FUNCTION_TEMPLATE
  };
  
  template&lt;typename Functor, class Enable = void&gt;
  struct get_invokable_kind {
      const static InvokableKind value = InvokableKind::NOT_INVOKABLE;
  };
  
  template&lt;typename Functor&gt;
  struct get_invokable_kind&lt;
    Functor,
    decltype(Functor().Invoke())
    &gt;
  {
      const static InvokableKind value = InvokableKind::INVOKABLE_FUNCTION;
  };
  
  template&lt;typename Functor&gt;
  struct get_invokable_kind&lt;
    Functor,
    decltype(Functor().Invoke&lt;void&gt;())
    &gt;
  {
      const static InvokableKind value = InvokableKind::INVOKABLE_FUNCTION_TEMPLATE;
  };
  
  
  int main() {
      using namespace std;
  
      cout &lt;&lt; (get_invokable_kind&lt;test1&gt;::value == InvokableKind::INVOKABLE_FUNCTION) &lt;&lt; endl;
      cout &lt;&lt; (get_invokable_kind&lt;test2&gt;::value == InvokableKind::INVOKABLE_FUNCTION_TEMPLATE) &lt;&lt; endl;
  
  }
  </code></pre>
  
  <hr>
  
  <p>What I'm trying to do is to create a metafunction for testing a specific definition of "invokability". And now I'm stuck on this <a href="http://ideone.com/lN4qoA" rel="nofollow">compilation error</a> on GCC 4.5.3:</p>
  
  <blockquote>
    <p>prog.cpp:37:3: error: template argument 2 is invalid</p>
  </blockquote>
  
  <p>What does it mean? Why can I specialize on <code>decltype(Functor().Invoke())</code>, but can not on <code>decltype(Functor().Invoke&lt;void&gt;())</code>?</p>