title: decltype in class template specialization
body: <p>I am trying to use decltype inside a template class as follows:</p>
  
  <pre><code>#include &lt;functional&gt;
  template &lt;typename T&gt;
  class A
  {
      typedef decltype(std::bind(&amp;A::f, std::declval&lt;A&gt;())) some_type;
  
      void f();
  };
  </code></pre>
  
  <p>That works fine, but now I'd like to add an explicit specialization:</p>
  
  <pre><code>template &lt;&gt;
  class A&lt;void&gt;
  {
      typedef decltype(std::bind(&amp;A::f, std::declval&lt;A&gt;())) some_type;
  
      void f();
  };
  </code></pre>
  
  <p>This time g++ gives an error:</p>
  
  <pre><code>test.cpp:14:33: error: incomplete type 'A&lt;void&gt;' used in nested name specifier
  </code></pre>
  
  <p>What am I doing wrong? I am using gcc 4.5.</p>
  
  <p>EDIT: If I move the declaration of <code>void f();</code> to above the typedef, as suggested by Johannes, I get (slightly) different errors:</p>
  
  <pre><code>test.cpp:15:62: error: invalid use of incomplete type 'class A&lt;void&gt;'
  test.cpp:13:1: error: declaration of 'class A&lt;void&gt;'
  test.cpp:15:62: error:   initializing argument 2 of 'std::_Bind&lt;typename std::_Maybe_wrap_member_pointer&lt;_Tp&gt;::type(_ArgTypes ...)&gt; std::bind(_Functor, _ArgTypes ...) [with _Functor = void (A&lt;void&gt;::*)(), _ArgTypes = {A&lt;void&gt;}, typename std::_Maybe_wrap_member_pointer&lt;_Tp&gt;::type = std::_Mem_fn&lt;void (A&lt;void&gt;::*)()&gt;]'
  test.cpp:15:62: error: invalid use of incomplete type 'class A&lt;void&gt;'
  test.cpp:13:1: error: declaration of 'class A&lt;void&gt;'
  test.cpp:15:62: error:   initializing argument 2 of 'std::_Bind&lt;typename std::_Maybe_wrap_member_pointer&lt;_Tp&gt;::type(_ArgTypes ...)&gt; std::bind(_Functor, _ArgTypes ...) [with _Functor = void (A&lt;void&gt;::*)(), _ArgTypes = {A&lt;void&gt;}, typename std::_Maybe_wrap_member_pointer&lt;_Tp&gt;::type = std::_Mem_fn&lt;void (A&lt;void&gt;::*)()&gt;]'
  </code></pre>