------- Comment #4 from Zarathustra at gentlemansclub dot de 2007-02-21 10:16 ------- Now the code was also compiled with 4.3.0 and produced the same error message.
I can make the actual failure more specific: The following code compiles fine: template<template<typename> class TOperator,typename TElement> void for_all_5(TElement elem, cons_end tail); template<template<typename> class TOperator,typename TElement, typename TTail> void for_all_5(TElement elem, TTail tail) { TOperator<TElement>()(elem); for_all_5<TOperator>(tail.elem,tail.tail); } template<template<typename> class TOperator,typename TElement> void for_all_5(TElement elem, cons_end tail) { TOperator<TElement>()(elem); } // -- snip -- // in main: for_all_5<op>(list.elem,list.tail); The difference is the forward declaration of the second for_all method. >From my understanding of the standard it is not necessary to do the forward declaration since by 14.6.4/1 declarations which are visible at the point of instantiation are to be considered and by 14.6.4.1/1 the point of instantiation of all template functions is at the definition of the main function. -- Zarathustra at gentlemansclub dot de changed: What |Removed |Added ---------------------------------------------------------------------------- Version|4.1.2 |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30822