This error is difficult to explain, but it comes from using static polymorphism to a bit of an extreme.
See the following code. In the code, if I derive a templatized class from a templatized class, and then use a templatized function with more than one template parameter, I get a less than helpful compile error of
error: invalid operands of types '<unresolved overloaded function type>' and 'bool' to binary 'operator<'
This issue does not occur when the derived class is not itself templatized, oddly enough, or when the templatized function only has one template argument. I'm totally stumped, so any help would be greatly appreciated. I'm using gcc 4.7.2 on fedora 7.
template <class Derived>
class BasicTemplate
{
protected:
template<bool param1, int param2, typename Param3>
void templatizedFunction(const Param3 & input)
{
}
};
template <class C>
class DerivedTemplate : public BasicTemplate<DerivedTemplate<C> >
{
using Base = BasicTemplate<DerivedTemplate<C> >;
public:
template <bool param1, int param2, typename Param3>
void templatizedFunction(const Param3 & input)
{
Base::templatizedFunction<param1, param2>(input);
}
C myData_;
};
class DerivedNonTemplate : public BasicTemplate<DerivedNonTemplate>
{
using Base = BasicTemplate<DerivedNonTemplate>;
public:
template <bool param1, int param2, typename Param3>
void templatizedFunction(const Param3 & input)
{
Base::templatizedFunction<param1, param2>(input);
}
};
int main()
{
DerivedTemplate<int> derivedTemplate;
DerivedNonTemplate derivedNonTemplate;
derivedTemplate.templatizedFunction<false, 1>(1);
derivedNonTemplate.templatizedFunction<false, 1>(1);
return 0;
}