title: Templates with implicit parameters, forward declaration, C++
body: <p>There is a declaration of template class with implicit parameters:</p>
  
  <p>List.h</p>
  
  <pre><code>template &lt;typename Item, const bool attribute = true&gt;
  class List: public OList &lt;item, attribute&gt;
  {
      public:
      List() : OList&lt;Item, attribute&gt; () {}
      ....
  };
  </code></pre>
  
  <p>I tried to use the fllowing forward declaration in a different header file:</p>
  
  <p>Analysis.h</p>
  
  <pre><code>template &lt;typename T, const bool attribute = true&gt;
  class List;
  </code></pre>
  
  <p>But G++ shows this error:</p>
  
  <pre><code>List.h:28: error: redefinition of default argument for `bool attribute'
  Analysis.h:43: error:   original definition appeared here
  </code></pre>
  
  <p>If I use the forward declaration without implicit parameters</p>
  
  <pre><code>template &lt;typename T, const bool attribute&gt;
  class List;
  </code></pre>
  
  <p>compiler does not accept this construction</p>
  
  <p>Analysis.h</p>
  
  <pre><code>void function (List &lt;Object&gt; *list)
  {
  }
  </code></pre>
  
  <p>and shows the following error (i.e. does not accept the implicit value):</p>
  
  <pre><code>Analysis.h:55: error: wrong number of template arguments (1, should be 2)
  Analysis.h:44: error: provided for `template&lt;class T, bool destructable&gt; struct List'
  Analysis.h:55: error: ISO C++ forbids declaration of `list' with no type
  </code></pre>
  
  <p><strong>Updated question:</strong></p>
  
  <p>I removed the default parameter from the template definition:</p>
  
  <p>List.h</p>
  
  <pre><code>template &lt;typename Item, const bool attribute&gt;
  class List: public OList &lt;item, attribute&gt;
  {
      public:
      List() : OList&lt;Item, attribute&gt; () {}
      ....
  };
  </code></pre>
  
  <p>The first file using class List has forward declaration with implicit value of the parameter attribute</p>
  
  <p>Analysis1.h</p>
  
  <pre><code>template &lt;typename T, const bool attribute = true&gt;
  class List;  //OK
  
  class Analysis1
  {
      void function(List &lt;Object&gt; *list); //OK
  };
  </code></pre>
  
  <p>The second class using class List WITH forward definition using the implicit value</p>
  
  <p>Analysis2.h</p>
  
  <pre><code>template &lt;typename T, const bool attribute = true&gt; // Redefinition of default argument for `bool attribute'
  class List; 
  
  class Analysis2
  {
      void function(List &lt;Object&gt; *list); //OK
  };
  </code></pre>
  
  <p>The second class using class List WITHOUT forward definition using the implicit value</p>
  
  <p>Analysis2.h</p>
  
  <pre><code>template &lt;typename T, const bool attribute&gt; // OK
  class List; 
  
  class Analysis2
  {
      void function(List &lt;Object&gt; *list); //Wrong number of template arguments (1, should be 2)
  };
  </code></pre>