title: Syntax error: 'constant' and Missing type specifier - int assumed. Note: C++ does not support default-int
body: <p>I am trying to create simple structure.</p>
  <pre><code>template &lt;typename T&gt;
  struct Element
  {
      T eValue;   // Element Value
      Element &lt;T&gt;* next_element;
  };
  
  
  template &lt;typename T, int size&gt;
  struct dynamic_array
  {
      Element &lt;T&gt; first_element;
      Element &lt;T&gt;* last_element = &amp;first_element;
  
      add(2);
  
      void add(int count)
      {
          for (int i = 0; i &lt; count; i++) {
              last_element -&gt; next_element = new Element &lt;T&gt;;
              last_element = last_element -&gt; next_element;
          }
      }
  };
  </code></pre>
  <p>And as you can see, I'm trying to use add() function inside the structure, but I get these errors:</p>
  <blockquote>
  <p>error C2059: syntax error: 'constant'</p>
  <p>message : see reference to class template instantiation 'dynamic_array&lt;T,size&gt;' being compiled</p>
  <p>error C4430: missing type specifier - int assumed. Note: C++ does not support default-int</p>
  <p>warning C4183: 'add': missing return type; assumed to be a member function returning 'int'</p>
  </blockquote>
  <p>But when I'm trying to use this function from main() function, code is being compiled successfully</p>
  <pre><code>int main()
  {
      dynamic_array &lt;int, 5&gt; myArray;
      myArray.add(5);
  }
  </code></pre>
  <p>I have no idea why I'm getting these errors. I can guess that it is something connected to template, because I started to use them recently</p>