title: C++ template specialization on functions
body: <p>I'm playing around with template specialization, and I've found an issue I can't seem to solve; this is my code:</p>
  
  <pre><code>template&lt;int length, typename T&gt;
  void test(T* array)
  {
      ...
      test&lt;length-1&gt;(array);
  }
  
  template&lt;typename T&gt;
  void test&lt;0&gt;(T* array)
  {
      return;
  }
  </code></pre>
  
  <p>So what I'm trying to do, is to pass the length, of what's to be processed in the template.</p>
  
  <p>The problem is, that the compilation of this, well outputs forever:</p>
  
  <pre><code>a.cpp:83:43: error: template-id 'test&lt;0&gt;' in declaration of primary template
  a.cpp: In function 'void test(T*) [with int length= -0x000000081, T = int]':
  a.cpp:77:9:   instantiated from 'void test(T*) [with int length= -0x000000080, T = int]'
  a.cpp:77:9:   instantiated from 'void test(T*) [with int length= -0x00000007f, T = int]'
  a.cpp:77:9:   [ skipping 151 instantiation contexts ]
  a.cpp:77:9:   instantiated from 'void test(T*) [with int length= 28, T = int]'
  a.cpp:77:9:   instantiated from 'void test(T*) [with int length= 29, T = int]'
  ...
  a.cpp: In function 'void test(T*) [with int length= -0x000000082, T = int]':
  a.cpp:77:9:   instantiated from 'void test(T*) [with int length= -0x000000081, T = int]'
  a.cpp:77:9:   instantiated from 'void test(T*) [with int length= -0x000000080, T = int]'
  </code></pre>
  
  <p>Last two lines, is pretty much the same as the first ones.</p>
  
  <p>To me it would seem, its not catching the specialization, hence: </p>
  
  <pre><code>a.cpp:83:43: error: template-id 'test&lt;0&gt;' in declaration of primary template
  </code></pre>
  
  <p>Am I correct?</p>
  
  <p>And if I'm correct, I'm guessing it's the issue that partial template specialisation is not allowed for function templates, so what would be the solution then, making a struct, and using specialisation on that?</p>