E2295 Too many candidate template specializations from 'specifier' (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

When reference a class template specialization, it is possible that more than one possible candidate might result from a single reference. This can only really happen among class partial specializations, when more than one partial specialization is contending for a possible match:

template<class T, class U>
class foo;
template<class T>
class foo<T, T *>;
template<class T>
class foo<T *, T>;
foo<int *, int *> x;  // error: which partial specialization to use?

In this example, both partial specializations are equally valid, and neither is more specialized than the other, so an error would result.