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